Properly check for SDK before nullifying attribution tag

Also adds @SuppressLint to RecognitionService#createContext

Fixes: 190759697
Test: manual
Change-Id: I8ad14f93f86285127d5d2674b0f9a4963b03c933
This commit is contained in:
Nate Myren
2021-06-10 15:37:43 -07:00
parent 49be55d145
commit 050f400b3f
2 changed files with 7 additions and 6 deletions

View File

@@ -229,6 +229,7 @@ public abstract class RecognitionService extends Service {
protected abstract void onStopListening(Callback listener);
@Override
@SuppressLint("MissingNullability")
public Context createContext(@NonNull ContextParams contextParams) {
if (contextParams.getNextAttributionSource() != null) {
if (mHandler.getLooper().equals(Looper.myLooper())) {

View File

@@ -4551,15 +4551,15 @@ public class AppOpsService extends IAppOpsService.Stub {
}
try {
if (mPlatformCompat.isChangeEnabledByPackageName(
if (!mPlatformCompat.isChangeEnabledByPackageName(
SECURITY_EXCEPTION_ON_INVALID_ATTRIBUTION_TAG_CHANGE, packageName,
userId) && mPlatformCompat.isChangeEnabledByUid(
userId) || !mPlatformCompat.isChangeEnabledByUid(
SECURITY_EXCEPTION_ON_INVALID_ATTRIBUTION_TAG_CHANGE,
callingUid) && !isAttributionTagValid) {
Slog.e(TAG, msg);
} else {
Slog.e(TAG, msg);
callingUid)) {
// Do not override tags if overriding is not enabled for this package
isAttributionTagValid = true;
}
Slog.e(TAG, msg);
} catch (RemoteException neverHappens) {
}
}