Ignore superMethods from non-Stub parents

In commit 9252e5ce, the logic did not ensure that the super method
belonged to the Stub class, and not any arbitrary method in a parent.

Refactor EnforcePermissionUtils by:
 - Removing isContainedInSubclassOfStub() in favour of containingStub(),
   which returns the Stub PsiClass. Document that this method does not
   mean that the argument is necessary an AIDL-generated method.
 - Update getContainingAidlInterface() to pass the PsiClass to
   findSuperMethod. This ensures that only the Stub class and its
   parents are considered.
 - Drop the check for IINTERFACE_INTERFACE. This is already verified in
   the inner call to isStub().

The same logic is applied manually to EnforcePermissionDetector, as each
condition in getContainingAidlInterface() raises a different error
message.

Add a test to confirm the behaviour of EnforcePermissionDetector.

Bug: 307433823
Test: atest --host AndroidGlobalLintCheckerTest
Test: atest --host AndroidFrameworkLintCheckerTest
Test: enforce_permission_counter
Change-Id: If791b6d8741e5db483589446484bb68061b67b70
3 files changed