Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9a23a153 authored by Peter Kalauskas's avatar Peter Kalauskas
Browse files

Fix malformed trace sections

In some scenarios, BiometricUnlockController#startWakeAndUnlock() may
have caused its parent's trace sections to end too early. Also, trace
all occurrences of "release wake-and-unlock", and rephrase trace section
for acquisition to use simple present tense for consistency and
succinctness, "acquire wake-and-unlock".

Test: Capture perfetto trace, inspect trace to verify all slices end
Flag: EXEMPT system tracing only
Bug: 352758494
Change-Id: If3343b36d5b89e5aec3a3d9176de35b4df220cc8
parent bff6d33b
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -369,10 +369,12 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp

    private void releaseBiometricWakeLock() {
        if (mWakeLock != null) {
            Trace.beginSection("release wake-and-unlock");
            mHandler.removeCallbacks(mReleaseBiometricWakeLockRunnable);
            mLogger.i("releasing biometric wakelock");
            mWakeLock.release();
            mWakeLock = null;
            Trace.endSection();
        }
    }

@@ -398,7 +400,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            }
            mWakeLock = mPowerManager.newWakeLock(
                    PowerManager.PARTIAL_WAKE_LOCK, BIOMETRIC_WAKE_LOCK_NAME);
            Trace.beginSection("acquiring wake-and-unlock");
            Trace.beginSection("acquire wake-and-unlock");
            mWakeLock.acquire();
            Trace.endSection();
            mLogger.i("biometric acquired, grabbing biometric wakelock");
@@ -412,15 +414,14 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
    public void onBiometricDetected(int userId, BiometricSourceType biometricSourceType,
            boolean isStrongBiometric) {
        Trace.beginSection("BiometricUnlockController#onBiometricDetected");
        if (mUpdateMonitor.isGoingToSleep()) {
            Trace.endSection();
            return;
        }
        if (!mUpdateMonitor.isGoingToSleep()) {
            startWakeAndUnlock(
                    MODE_SHOW_BOUNCER,
                    BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType)
            );
        }
        Trace.endSection();
    }

    @Override
    public void onBiometricAuthenticated(int userId, BiometricSourceType biometricSourceType,
@@ -451,6 +452,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        } else {
            mLogger.d("onBiometricUnlocked aborted by bypass controller");
        }
        Trace.endSection();
    }

    /**
@@ -479,6 +481,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
            @WakeAndUnlockMode int mode,
            BiometricUnlockSource biometricUnlockSource
    ) {
        Trace.beginSection("BiometricUnlockController#startWakeAndUnlock");
        mLogger.logStartWakeAndUnlock(mode);
        boolean wasDeviceInteractive = mUpdateMonitor.isDeviceInteractive();
        mMode = mode;
@@ -501,9 +504,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                        "android.policy:BIOMETRIC"
                );
            }
            Trace.beginSection("release wake-and-unlock");
            releaseBiometricWakeLock();
            Trace.endSection();
        };

        final boolean wakeInKeyguard = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM