Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88319e97 authored by Nate Myren's avatar Nate Myren Committed by Android (Google) Code Review
Browse files

Merge "More robust null check in isTrustedVoiceServiceProxy"

parents efa9bd99 ecb07b0c
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -7618,16 +7618,18 @@ public class AppOpsManager {
                mContext.getContentResolver(), Settings.Secure.VOICE_INTERACTION_SERVICE);

        final String voiceRecognitionServicePackageName =
                voiceRecognitionComponent != null ? ComponentName.unflattenFromString(
                        voiceRecognitionComponent).getPackageName() : "";
                getComponentPackageNameFromString(voiceRecognitionComponent);
        final String voiceInteractionServicePackageName =
                voiceInteractionComponent != null ? ComponentName.unflattenFromString(
                        voiceInteractionComponent).getPackageName() : "";

                getComponentPackageNameFromString(voiceInteractionComponent);
        return Objects.equals(packageName, voiceRecognitionServicePackageName) && Objects.equals(
                voiceRecognitionServicePackageName, voiceInteractionServicePackageName);
    }

    private String getComponentPackageNameFromString(String from) {
        ComponentName componentName = from != null ? ComponentName.unflattenFromString(from) : null;
        return componentName != null ? componentName.getPackageName() : "";
    }

    /**
     * Do a quick check for whether an application might be able to perform an operation.
     * This is <em>not</em> a security check; you must use {@link #noteOp(String, int, String,
+7 −4
Original line number Diff line number Diff line
@@ -3026,15 +3026,18 @@ public class AppOpsService extends IAppOpsService.Stub {
                mContext.getContentResolver(), Settings.Secure.VOICE_INTERACTION_SERVICE);

        final String voiceRecognitionServicePackageName =
                voiceRecognitionComponent != null ? ComponentName.unflattenFromString(
                        voiceRecognitionComponent).getPackageName() : "";
                getComponentPackageNameFromString(voiceRecognitionComponent);
        final String voiceInteractionServicePackageName =
                voiceInteractionComponent != null ? ComponentName.unflattenFromString(
                        voiceInteractionComponent).getPackageName() : "";
                getComponentPackageNameFromString(voiceInteractionComponent);
        return Objects.equals(packageName, voiceRecognitionServicePackageName) && Objects.equals(
                voiceRecognitionServicePackageName, voiceInteractionServicePackageName);
    }

    private String getComponentPackageNameFromString(String from) {
        ComponentName componentName = from != null ? ComponentName.unflattenFromString(from) : null;
        return componentName != null ? componentName.getPackageName() : "";
    }

    @Override
    public int noteProxyOperation(int code, int proxiedUid, String proxiedPackageName,
            String proxiedAttributionTag, int proxyUid, String proxyPackageName,