diff --git a/services/backup/lint-baseline.xml b/services/backup/lint-baseline.xml new file mode 100644 index 0000000000000..28bb937cfd9c7 --- /dev/null +++ b/services/backup/lint-baseline.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/services/companion/lint-baseline.xml b/services/companion/lint-baseline.xml new file mode 100644 index 0000000000000..03eae3901e51e --- /dev/null +++ b/services/companion/lint-baseline.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/services/usb/lint-baseline.xml b/services/usb/lint-baseline.xml new file mode 100644 index 0000000000000..c2c0a350d5ada --- /dev/null +++ b/services/usb/lint-baseline.xml @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/tools/lint/checks/src/main/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsDetector.kt b/tools/lint/checks/src/main/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsDetector.kt index 641f337ab9870..fe567da7c017f 100644 --- a/tools/lint/checks/src/main/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsDetector.kt +++ b/tools/lint/checks/src/main/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsDetector.kt @@ -45,7 +45,8 @@ class CallingSettingsNonUserGetterMethodsDetector : Detector(), SourceCodeScanne evaluator.isMemberInClass(method, "android.provider.Settings.System") ) { val message = getIncidentMessageNonUserGetterMethods(getMethodSignature(method)) - context.report(ISSUE_NON_USER_GETTER_CALLED, node, context.getLocation(node), message) + context.report(ISSUE_NON_USER_GETTER_CALLED, node, context.getNameLocation(node), + message) } } @@ -68,7 +69,7 @@ class CallingSettingsNonUserGetterMethodsDetector : Detector(), SourceCodeScanne """, category = Category.CORRECTNESS, priority = 6, - severity = Severity.WARNING, + severity = Severity.ERROR, implementation = Implementation( CallingSettingsNonUserGetterMethodsDetector::class.java, Scope.JAVA_FILE_SCOPE diff --git a/tools/lint/checks/src/test/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsIssueDetectorTest.kt b/tools/lint/checks/src/test/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsIssueDetectorTest.kt index 1034029f6e9d8..e72f384163102 100644 --- a/tools/lint/checks/src/test/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsIssueDetectorTest.kt +++ b/tools/lint/checks/src/test/java/com/google/android/lint/CallingSettingsNonUserGetterMethodsIssueDetectorTest.kt @@ -71,13 +71,13 @@ class CallingSettingsNonUserGetterMethodsIssueDetectorTest : LintDetectorTest() .run() .expect( """ - src/test/pkg/TestClass1.java:5: Warning: \ + src/test/pkg/TestClass1.java:5: Error: \ android.provider.Settings.Secure#getInt() called from system process. \ Please call android.provider.Settings.Secure#getIntForUser() instead. \ [NonUserGetterCalled] final int value = Secure.getInt(context.getContentResolver(), - ^ - 0 errors, 1 warnings + ~~~~~~ + 1 errors, 0 warnings """.addLineContinuation() ) } @@ -100,13 +100,13 @@ class CallingSettingsNonUserGetterMethodsIssueDetectorTest : LintDetectorTest() .run() .expect( """ - src/test/pkg/TestClass1.java:5: Warning: \ + src/test/pkg/TestClass1.java:5: Error: \ android.provider.Settings.System#getFloat() called from system process. \ Please call android.provider.Settings.System#getFloatForUser() instead. \ [NonUserGetterCalled] final float value = System.getFloat(context.getContentResolver(), - ^ - 0 errors, 1 warnings + ~~~~~~~~ + 1 errors, 0 warnings """.addLineContinuation() ) } @@ -130,13 +130,13 @@ class CallingSettingsNonUserGetterMethodsIssueDetectorTest : LintDetectorTest() .run() .expect( """ - src/test/pkg/TestClass1.java:5: Warning: \ + src/test/pkg/TestClass1.java:5: Error: \ android.provider.Settings.System#getFloat() called from system process. \ Please call android.provider.Settings.System#getFloatForUser() instead. \ [NonUserGetterCalled] float value = Settings.System.getFloat(context.getContentResolver(), - ^ - 0 errors, 1 warnings + ~~~~~~~~ + 1 errors, 0 warnings """.addLineContinuation() ) } @@ -163,19 +163,19 @@ class CallingSettingsNonUserGetterMethodsIssueDetectorTest : LintDetectorTest() .run() .expect( """ - src/test/pkg/TestClass1.java:6: Warning: \ + src/test/pkg/TestClass1.java:6: Error: \ android.provider.Settings.Secure#getLong() called from system process. \ Please call android.provider.Settings.Secure#getLongForUser() instead. \ [NonUserGetterCalled] final long value1 = Secure.getLong(context.getContentResolver(), - ^ - src/test/pkg/TestClass1.java:8: Warning: \ + ~~~~~~~ + src/test/pkg/TestClass1.java:8: Error: \ android.provider.Settings.System#getString() called from system process. \ Please call android.provider.Settings.System#getStringForUser() instead. \ [NonUserGetterCalled] final String value2 = System.getString(context.getContentResolver(), - ^ - 0 errors, 2 warnings + ~~~~~~~~~ + 2 errors, 0 warnings """.addLineContinuation() ) }