Prevent race condition by foregroundAppPackageName
Create a local variable from the member variable so it cannot become null part way through. Bug: 235064663 Test: Builds Change-Id: Id5d13ee105fc2c78327ff3ddb3839f6cbd99fbab
This commit is contained in:
@@ -993,8 +993,9 @@ class AutomaticBrightnessController {
|
||||
final String packageName = info.topActivity.getPackageName();
|
||||
// If the app didn't change, there's nothing to do. Otherwise, we have to
|
||||
// update the category and re-apply the brightness correction.
|
||||
if (mForegroundAppPackageName != null
|
||||
&& mForegroundAppPackageName.equals(packageName)) {
|
||||
String currentForegroundAppPackageName = mForegroundAppPackageName;
|
||||
if (currentForegroundAppPackageName != null
|
||||
&& currentForegroundAppPackageName.equals(packageName)) {
|
||||
return;
|
||||
}
|
||||
mPendingForegroundAppPackageName = packageName;
|
||||
|
||||
Reference in New Issue
Block a user