Merge "Prevent race condition by foregroundAppPackageName" into tm-qpr-dev

This commit is contained in:
Fiona Campbell
2022-08-17 09:16:30 +00:00
committed by Android (Google) Code Review

View File

@@ -993,8 +993,9 @@ class AutomaticBrightnessController {
final String packageName = info.topActivity.getPackageName(); final String packageName = info.topActivity.getPackageName();
// If the app didn't change, there's nothing to do. Otherwise, we have to // If the app didn't change, there's nothing to do. Otherwise, we have to
// update the category and re-apply the brightness correction. // update the category and re-apply the brightness correction.
if (mForegroundAppPackageName != null String currentForegroundAppPackageName = mForegroundAppPackageName;
&& mForegroundAppPackageName.equals(packageName)) { if (currentForegroundAppPackageName != null
&& currentForegroundAppPackageName.equals(packageName)) {
return; return;
} }
mPendingForegroundAppPackageName = packageName; mPendingForegroundAppPackageName = packageName;