Loading AconfigFlags.bp +2 −0 Original line number Diff line number Diff line Loading @@ -379,6 +379,7 @@ cc_aconfig_library { aconfig_declarations { name: "com.android.internal.os.flags-aconfig", package: "com.android.internal.os", container: "system", srcs: ["core/java/com/android/internal/os/flags.aconfig"], } Loading Loading @@ -853,6 +854,7 @@ java_aconfig_library { aconfig_declarations { name: "com.android.server.contextualsearch.flags-aconfig", package: "com.android.server.contextualsearch.flags", container: "system", srcs: ["services/contextualsearch/flags/flags.aconfig"], } Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,7 @@ package android.app { method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int); method @RequiresPermission(android.Manifest.permission.MANAGE_APP_OPS_MODES) public void setMode(int, int, String, int); method public static int strOpToOp(@NonNull String); method public int unsafeCheckOpRawNoThrow(@NonNull String, @NonNull android.content.AttributionSource); field public static final int ATTRIBUTION_CHAIN_ID_NONE = -1; // 0xffffffff field public static final int ATTRIBUTION_FLAGS_NONE = 0; // 0x0 field public static final int ATTRIBUTION_FLAG_ACCESSOR = 1; // 0x1 Loading core/java/android/app/AppOpsManager.java +14 −2 Original line number Diff line number Diff line Loading @@ -8783,6 +8783,18 @@ public class AppOpsManager { attributionSource.getPackageName(), attributionSource.getDeviceId()); } /** * Returns the <em>raw</em> mode associated with the op. * Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. public int unsafeCheckOpRawNoThrow( @NonNull String op, @NonNull AttributionSource attributionSource) { return unsafeCheckOpRawNoThrow(strOpToOp(op), attributionSource); } /** * Returns the <em>raw</em> mode associated with the op. * Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. Loading @@ -8798,8 +8810,8 @@ public class AppOpsManager { if (virtualDeviceId == Context.DEVICE_ID_DEFAULT) { return mService.checkOperationRaw(op, uid, packageName, null); } else { return mService.checkOperationRawForDevice(op, uid, packageName, null, Context.DEVICE_ID_DEFAULT); return mService.checkOperationRawForDevice( op, uid, packageName, null, virtualDeviceId); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading core/java/android/app/Notification.java +39 −7 Original line number Diff line number Diff line Loading @@ -93,7 +93,10 @@ import android.text.style.AbsoluteSizeSpan; import android.text.style.CharacterStyle; import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StrikethroughSpan; import android.text.style.StyleSpan; import android.text.style.TextAppearanceSpan; import android.text.style.UnderlineSpan; import android.util.ArraySet; import android.util.Log; import android.util.Pair; Loading Loading @@ -3167,9 +3170,6 @@ public class Notification implements Parcelable + " instance is a custom Parcelable and not allowed in Notification"); return cs.toString(); } if (Flags.cleanUpSpansAndNewLines()) { return stripStyling(cs); } return removeTextSizeSpans(cs); } Loading Loading @@ -8285,9 +8285,6 @@ public class Notification implements Parcelable */ public BigTextStyle bigText(CharSequence cs) { mBigText = safeCharSequence(cs); if (Flags.cleanUpSpansAndNewLines()) { mBigText = cleanUpNewLines(mBigText); } return this; } Loading Loading @@ -8358,6 +8355,9 @@ public class Notification implements Parcelable // Replace the text with the big text, but only if the big text is not empty. CharSequence bigTextText = mBuilder.processLegacyText(mBigText); if (Flags.cleanUpSpansAndNewLines()) { bigTextText = cleanUpNewLines(stripStyling(bigTextText)); } if (!TextUtils.isEmpty(bigTextText)) { p.text(bigTextText); } Loading Loading @@ -9273,11 +9273,43 @@ public class Notification implements Parcelable */ public void ensureColorContrastOrStripStyling(int backgroundColor) { if (Flags.cleanUpSpansAndNewLines()) { mText = stripStyling(mText); mText = stripNonStyleSpans(mText); } else { ensureColorContrast(backgroundColor); } } private CharSequence stripNonStyleSpans(CharSequence text) { if (text instanceof Spanned) { Spanned ss = (Spanned) text; Object[] spans = ss.getSpans(0, ss.length(), Object.class); SpannableStringBuilder builder = new SpannableStringBuilder(ss.toString()); for (Object span : spans) { final Object resultSpan; if (span instanceof StyleSpan || span instanceof StrikethroughSpan || span instanceof UnderlineSpan) { resultSpan = span; } else if (span instanceof TextAppearanceSpan) { final TextAppearanceSpan originalSpan = (TextAppearanceSpan) span; resultSpan = new TextAppearanceSpan( null, originalSpan.getTextStyle(), -1, null, null); } else { continue; } builder.setSpan(resultSpan, ss.getSpanStart(span), ss.getSpanEnd(span), ss.getSpanFlags(span)); } return builder; } return text; } /** * Updates TextAppearance spans in the message text so it has sufficient contrast * against its background. Loading core/java/android/companion/virtual/camera/VirtualCameraConfig.java +4 −8 Original line number Diff line number Diff line Loading @@ -237,19 +237,15 @@ public final class VirtualCameraConfig implements Parcelable { @IntRange(from = 1) int height, @ImageFormat.Format int format, @IntRange(from = 1) int maximumFramesPerSecond) { // TODO(b/310857519): Check dimension upper limits based on the maximum texture size // supported by the current device, instead of hardcoded limits. if (width <= 0 || width > VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT) { if (width <= 0) { throw new IllegalArgumentException( "Invalid width passed for stream config: " + width + ", must be between 1 and " + VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT); + ", must be greater than 0"); } if (height <= 0 || height > VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT) { if (height <= 0) { throw new IllegalArgumentException( "Invalid height passed for stream config: " + height + ", must be between 1 and " + VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT); + ", must be greater than 0"); } if (!isFormatSupported(format)) { throw new IllegalArgumentException( Loading Loading
AconfigFlags.bp +2 −0 Original line number Diff line number Diff line Loading @@ -379,6 +379,7 @@ cc_aconfig_library { aconfig_declarations { name: "com.android.internal.os.flags-aconfig", package: "com.android.internal.os", container: "system", srcs: ["core/java/com/android/internal/os/flags.aconfig"], } Loading Loading @@ -853,6 +854,7 @@ java_aconfig_library { aconfig_declarations { name: "com.android.server.contextualsearch.flags-aconfig", package: "com.android.server.contextualsearch.flags", container: "system", srcs: ["services/contextualsearch/flags/flags.aconfig"], } Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -263,6 +263,7 @@ package android.app { method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int); method @RequiresPermission(android.Manifest.permission.MANAGE_APP_OPS_MODES) public void setMode(int, int, String, int); method public static int strOpToOp(@NonNull String); method public int unsafeCheckOpRawNoThrow(@NonNull String, @NonNull android.content.AttributionSource); field public static final int ATTRIBUTION_CHAIN_ID_NONE = -1; // 0xffffffff field public static final int ATTRIBUTION_FLAGS_NONE = 0; // 0x0 field public static final int ATTRIBUTION_FLAG_ACCESSOR = 1; // 0x1 Loading
core/java/android/app/AppOpsManager.java +14 −2 Original line number Diff line number Diff line Loading @@ -8783,6 +8783,18 @@ public class AppOpsManager { attributionSource.getPackageName(), attributionSource.getDeviceId()); } /** * Returns the <em>raw</em> mode associated with the op. * Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. * @hide */ @TestApi @SuppressLint("UnflaggedApi") // @TestApi without associated feature. public int unsafeCheckOpRawNoThrow( @NonNull String op, @NonNull AttributionSource attributionSource) { return unsafeCheckOpRawNoThrow(strOpToOp(op), attributionSource); } /** * Returns the <em>raw</em> mode associated with the op. * Does not throw a security exception, does not translate {@link #MODE_FOREGROUND}. Loading @@ -8798,8 +8810,8 @@ public class AppOpsManager { if (virtualDeviceId == Context.DEVICE_ID_DEFAULT) { return mService.checkOperationRaw(op, uid, packageName, null); } else { return mService.checkOperationRawForDevice(op, uid, packageName, null, Context.DEVICE_ID_DEFAULT); return mService.checkOperationRawForDevice( op, uid, packageName, null, virtualDeviceId); } } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading
core/java/android/app/Notification.java +39 −7 Original line number Diff line number Diff line Loading @@ -93,7 +93,10 @@ import android.text.style.AbsoluteSizeSpan; import android.text.style.CharacterStyle; import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StrikethroughSpan; import android.text.style.StyleSpan; import android.text.style.TextAppearanceSpan; import android.text.style.UnderlineSpan; import android.util.ArraySet; import android.util.Log; import android.util.Pair; Loading Loading @@ -3167,9 +3170,6 @@ public class Notification implements Parcelable + " instance is a custom Parcelable and not allowed in Notification"); return cs.toString(); } if (Flags.cleanUpSpansAndNewLines()) { return stripStyling(cs); } return removeTextSizeSpans(cs); } Loading Loading @@ -8285,9 +8285,6 @@ public class Notification implements Parcelable */ public BigTextStyle bigText(CharSequence cs) { mBigText = safeCharSequence(cs); if (Flags.cleanUpSpansAndNewLines()) { mBigText = cleanUpNewLines(mBigText); } return this; } Loading Loading @@ -8358,6 +8355,9 @@ public class Notification implements Parcelable // Replace the text with the big text, but only if the big text is not empty. CharSequence bigTextText = mBuilder.processLegacyText(mBigText); if (Flags.cleanUpSpansAndNewLines()) { bigTextText = cleanUpNewLines(stripStyling(bigTextText)); } if (!TextUtils.isEmpty(bigTextText)) { p.text(bigTextText); } Loading Loading @@ -9273,11 +9273,43 @@ public class Notification implements Parcelable */ public void ensureColorContrastOrStripStyling(int backgroundColor) { if (Flags.cleanUpSpansAndNewLines()) { mText = stripStyling(mText); mText = stripNonStyleSpans(mText); } else { ensureColorContrast(backgroundColor); } } private CharSequence stripNonStyleSpans(CharSequence text) { if (text instanceof Spanned) { Spanned ss = (Spanned) text; Object[] spans = ss.getSpans(0, ss.length(), Object.class); SpannableStringBuilder builder = new SpannableStringBuilder(ss.toString()); for (Object span : spans) { final Object resultSpan; if (span instanceof StyleSpan || span instanceof StrikethroughSpan || span instanceof UnderlineSpan) { resultSpan = span; } else if (span instanceof TextAppearanceSpan) { final TextAppearanceSpan originalSpan = (TextAppearanceSpan) span; resultSpan = new TextAppearanceSpan( null, originalSpan.getTextStyle(), -1, null, null); } else { continue; } builder.setSpan(resultSpan, ss.getSpanStart(span), ss.getSpanEnd(span), ss.getSpanFlags(span)); } return builder; } return text; } /** * Updates TextAppearance spans in the message text so it has sufficient contrast * against its background. Loading
core/java/android/companion/virtual/camera/VirtualCameraConfig.java +4 −8 Original line number Diff line number Diff line Loading @@ -237,19 +237,15 @@ public final class VirtualCameraConfig implements Parcelable { @IntRange(from = 1) int height, @ImageFormat.Format int format, @IntRange(from = 1) int maximumFramesPerSecond) { // TODO(b/310857519): Check dimension upper limits based on the maximum texture size // supported by the current device, instead of hardcoded limits. if (width <= 0 || width > VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT) { if (width <= 0) { throw new IllegalArgumentException( "Invalid width passed for stream config: " + width + ", must be between 1 and " + VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT); + ", must be greater than 0"); } if (height <= 0 || height > VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT) { if (height <= 0) { throw new IllegalArgumentException( "Invalid height passed for stream config: " + height + ", must be between 1 and " + VirtualCameraStreamConfig.DIMENSION_UPPER_LIMIT); + ", must be greater than 0"); } if (!isFormatSupported(format)) { throw new IllegalArgumentException( Loading