summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tim Van Patten <timvp@google.com> 2025-01-03 09:49:26 -0700
committer Tim Van Patten <timvp@google.com> 2025-01-06 16:37:57 +0000
commitabfc8bba86f7ac8dd3693728a213e7d7c427bdff (patch)
tree06f749c565cd20c50b184a10bfd774390b9fed8d
parent4288aff850a70ce5563afce07b9bd093ca60f163 (diff)
Update logging in getAnglePackageName()
The ANGLE APK may not be present if ANGLE is the native driver. However, we still want to attempt to load the ANGLE APK if it's present so we use the latest/developer libraries. If the APK is not present, this can lead to misleading log messages such as: Invalid number of ANGLE packages. Required: 1, Found: 0 It is not "invalid" for zero ANGLE APKs to be installed when ANGLE is the native driver. Update the logging to separate out when: * No APKs are installed, omitting the "invalid" messaging. * Too many ANGLE packages are found, since there should never be >1. This also removes the redundant logging from setupAngleFromApk(). Also cleans up ".get(0)" to ".getFirst()", to remove a warning. Bug: 372694741 Test: Manual verification of log message with ANGLE as native driver. Change-Id: Icf820b44c4c7391f08d17d44a59951ba6340a2d0
-rw-r--r--core/java/android/os/GraphicsEnvironment.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/core/java/android/os/GraphicsEnvironment.java b/core/java/android/os/GraphicsEnvironment.java
index beb9a935a6ee..0f1140efe22b 100644
--- a/core/java/android/os/GraphicsEnvironment.java
+++ b/core/java/android/os/GraphicsEnvironment.java
@@ -479,9 +479,11 @@ public class GraphicsEnvironment {
final List<ResolveInfo> resolveInfos =
pm.queryIntentActivities(intent, PackageManager.MATCH_SYSTEM_ONLY);
- if (resolveInfos.size() != 1) {
- Log.v(TAG, "Invalid number of ANGLE packages. Required: 1, Found: "
- + resolveInfos.size());
+ if (resolveInfos.isEmpty()) {
+ Log.v(TAG, "No ANGLE packages installed.");
+ return "";
+ } else if (resolveInfos.size() > 1) {
+ Log.v(TAG, "Too many ANGLE packages found: " + resolveInfos.size());
if (DEBUG) {
for (ResolveInfo resolveInfo : resolveInfos) {
Log.d(TAG, "Found ANGLE package: " + resolveInfo.activityInfo.packageName);
@@ -491,7 +493,7 @@ public class GraphicsEnvironment {
}
// Must be exactly 1 ANGLE PKG found to get here.
- return resolveInfos.get(0).activityInfo.packageName;
+ return resolveInfos.getFirst().activityInfo.packageName;
}
/**
@@ -580,7 +582,6 @@ public class GraphicsEnvironment {
if (angleInfo == null) {
anglePkgName = getAnglePackageName(packageManager);
if (TextUtils.isEmpty(anglePkgName)) {
- Log.v(TAG, "Failed to find ANGLE package.");
return false;
}