Loading services/core/java/com/android/server/pm/permission/LegacyPermissionManagerService.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -413,8 +413,8 @@ public class LegacyPermissionManagerService extends ILegacyPermissionManager.Stu return result; return result; } } mContext.getSystemService(AppOpsManager.class).noteOpNoThrow( mContext.getSystemService(AppOpsManager.class).noteOpNoThrow( AppOpsManager.OP_RECEIVE_AMBIENT_TRIGGER_AUDIO, uid, packageName, AppOpsManager.OP_RECORD_AUDIO_HOTWORD, uid, packageName, attributionTag, attributionTag, reason); reason); return result; return result; } } } } Loading services/core/java/com/android/server/policy/AppOpsPolicy.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -202,9 +202,8 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat } } private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { // The HotwordDetectionService APIs aren't ready yet for Auto or TV. // Usage of the HotwordDetectionService won't be enforced until a later release. return !(pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) return false; || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)); } } @Override @Override Loading services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −7 Original line number Original line Diff line number Diff line Loading @@ -46,11 +46,9 @@ import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPH import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED_FROM_RESTART; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED_FROM_RESTART; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECT_UNEXPECTED_CALLBACK; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECT_UNEXPECTED_CALLBACK; import static com.android.server.voiceinteraction.SoundTriggerSessionPermissionsDecorator.enforcePermissionForPreflight; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.AppOpsManager; import android.content.ComponentName; import android.content.ComponentName; import android.content.ContentCaptureOptions; import android.content.ContentCaptureOptions; import android.content.Context; import android.content.Context; Loading Loading @@ -1162,11 +1160,12 @@ final class HotwordDetectionConnection { // TODO: Share this code with SoundTriggerMiddlewarePermission. // TODO: Share this code with SoundTriggerMiddlewarePermission. private void enforcePermissionsForDataDelivery() { private void enforcePermissionsForDataDelivery() { Binder.withCleanCallingIdentity(() -> { Binder.withCleanCallingIdentity(() -> { enforcePermissionForPreflight(mContext, mVoiceInteractorIdentity, RECORD_AUDIO); // Hack to make sure we show the mic privacy-indicator since the Trusted Hotword int hotwordOp = AppOpsManager.strOpToOp(AppOpsManager.OPSTR_RECORD_AUDIO_HOTWORD); // requirement isn't being enforced for now. Normally, we would note the HOTWORD op here mContext.getSystemService(AppOpsManager.class).noteOpNoThrow(hotwordOp, // instead. mVoiceInteractorIdentity.uid, mVoiceInteractorIdentity.packageName, enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, mVoiceInteractorIdentity.attributionTag, OP_MESSAGE); RECORD_AUDIO, OP_MESSAGE); enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, CAPTURE_AUDIO_HOTWORD, OP_MESSAGE); CAPTURE_AUDIO_HOTWORD, OP_MESSAGE); }); }); Loading Loading
services/core/java/com/android/server/pm/permission/LegacyPermissionManagerService.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -413,8 +413,8 @@ public class LegacyPermissionManagerService extends ILegacyPermissionManager.Stu return result; return result; } } mContext.getSystemService(AppOpsManager.class).noteOpNoThrow( mContext.getSystemService(AppOpsManager.class).noteOpNoThrow( AppOpsManager.OP_RECEIVE_AMBIENT_TRIGGER_AUDIO, uid, packageName, AppOpsManager.OP_RECORD_AUDIO_HOTWORD, uid, packageName, attributionTag, attributionTag, reason); reason); return result; return result; } } } } Loading
services/core/java/com/android/server/policy/AppOpsPolicy.java +2 −3 Original line number Original line Diff line number Diff line Loading @@ -202,9 +202,8 @@ public final class AppOpsPolicy implements AppOpsManagerInternal.CheckOpsDelegat } } private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { private static boolean isHotwordDetectionServiceRequired(PackageManager pm) { // The HotwordDetectionService APIs aren't ready yet for Auto or TV. // Usage of the HotwordDetectionService won't be enforced until a later release. return !(pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) return false; || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK)); } } @Override @Override Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −7 Original line number Original line Diff line number Diff line Loading @@ -46,11 +46,9 @@ import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPH import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED_FROM_RESTART; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECTED_FROM_RESTART; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECT_UNEXPECTED_CALLBACK; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__REJECT_UNEXPECTED_CALLBACK; import static com.android.server.voiceinteraction.SoundTriggerSessionPermissionsDecorator.enforcePermissionForPreflight; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.app.AppOpsManager; import android.content.ComponentName; import android.content.ComponentName; import android.content.ContentCaptureOptions; import android.content.ContentCaptureOptions; import android.content.Context; import android.content.Context; Loading Loading @@ -1162,11 +1160,12 @@ final class HotwordDetectionConnection { // TODO: Share this code with SoundTriggerMiddlewarePermission. // TODO: Share this code with SoundTriggerMiddlewarePermission. private void enforcePermissionsForDataDelivery() { private void enforcePermissionsForDataDelivery() { Binder.withCleanCallingIdentity(() -> { Binder.withCleanCallingIdentity(() -> { enforcePermissionForPreflight(mContext, mVoiceInteractorIdentity, RECORD_AUDIO); // Hack to make sure we show the mic privacy-indicator since the Trusted Hotword int hotwordOp = AppOpsManager.strOpToOp(AppOpsManager.OPSTR_RECORD_AUDIO_HOTWORD); // requirement isn't being enforced for now. Normally, we would note the HOTWORD op here mContext.getSystemService(AppOpsManager.class).noteOpNoThrow(hotwordOp, // instead. mVoiceInteractorIdentity.uid, mVoiceInteractorIdentity.packageName, enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, mVoiceInteractorIdentity.attributionTag, OP_MESSAGE); RECORD_AUDIO, OP_MESSAGE); enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, enforcePermissionForDataDelivery(mContext, mVoiceInteractorIdentity, CAPTURE_AUDIO_HOTWORD, OP_MESSAGE); CAPTURE_AUDIO_HOTWORD, OP_MESSAGE); }); }); Loading