summaryrefslogtreecommitdiff
path: root/core/java/android/app/AppOpsManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/app/AppOpsManager.java')
-rw-r--r--core/java/android/app/AppOpsManager.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java
index 26b4234fd14b..d6cf8fffe586 100644
--- a/core/java/android/app/AppOpsManager.java
+++ b/core/java/android/app/AppOpsManager.java
@@ -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,