Skip to content

Commit

Permalink
Merge "Enable quirk detector for 📷camera-viewfinder" into androidx-main
Browse files Browse the repository at this point in the history
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Mar 15, 2022
2 parents a967b37 + 1eb6c52 commit fbb17f3
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 35 deletions.
4 changes: 4 additions & 0 deletions camera/camera-viewfinder/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ android {
}

testOptions.unitTests.includeAndroidResources = true

lintOptions {
enable 'CameraXQuirksClassDetector'
}
}

androidx {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@
/**
* A quirk where a scaled up SurfaceView is not cropped by the parent View.
*
* <p> On certain Xiaomi devices, when the scale type is FILL_* and the preview is scaled up
* to be larger than its parent, the SurfaceView is not cropped by its parent. As the result, the
* preview incorrectly covers the neighboring UI elements. b/211370840
* <p>QuirkSummary
* Bug Id: 211370840
* Description: On certain Xiaomi devices, when the scale type is FILL_* and the preview is
* scaled up to be larger than its parent, the SurfaceView is not cropped by its
* parent. As the result, the preview incorrectly covers the neighboring UI
* elements.
* Device(s): XIAOMI M2101K7AG
*/
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public class SurfaceViewNotCroppedByParentQuirk implements Quirk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
/**
* A quirk where SurfaceView is stretched.
*
* <p> On certain Samsung devices, transform APIs (e.g. View#setScaleX) do not work as intended.
* b/129403806
* <p>QuirkSummary
* Bug Id: 129403806
* Description: On certain Samsung devices, transform APIs (e.g. View#setScaleX) do not work
* as intended.
* Device(s): SAMSUNG F2Q Q2Q
*/
@RequiresApi(21) // TODO(b/200306659): Remove and replace with annotation on package-info.java
public class SurfaceViewStretchedQuirk implements Quirk {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ class CameraXQuirksClassDetector : Detector(), Detector.UastScanner {
comments.forEach { sb.append(it.text) }
val comment = sb.append("\n").toString()

if (!comment.contains("@QuirkSummary")) {
if (!comment.contains("<p>QuirkSummary") ||
!comment.contains("Bug Id:") ||
!comment.contains("Description:") ||
!comment.contains("Device(s):")) {
val implForInsertion = """
* @QuirkSummary
* <p>QuirkSummary
* Bug Id:
* Description:
* Device(s):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class CameraXQuirksClassDetectorTest : AbstractLintDetectorTest(
val expected = """
src/androidx/CameraXMissingQuirkSummaryJava.java:22: Error: CameraX quirks should include this template in the javadoc:
* @QuirkSummary
* <p>QuirkSummary
* Bug Id:
* Description:
* Device(s):
Expand Down

0 comments on commit fbb17f3

Please sign in to comment.