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

Commit 3d74755d authored by Yi Kong's avatar Yi Kong Committed by Gerrit Code Review
Browse files

Merge "profcollect: Use postDelayed instead of starting a thread and sleep" into main

parents b6c0fa01 cad7d7fb
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -323,16 +323,14 @@ public final class ProfcollectForwardingService extends SystemService {
                "dex2oat_trace_freq", 25);
        int randomNum = ThreadLocalRandom.current().nextInt(100);
        if (randomNum < traceFrequency) {
            BackgroundThread.get().getThreadHandler().post(() -> {
            // Dex2oat could take a while before it starts. Add a short delay before start tracing.
            BackgroundThread.get().getThreadHandler().postDelayed(() -> {
                try {
                    // Dex2oat could take a while before it starts. Add a short delay before start
                    // tracing.
                    Thread.sleep(1000);
                    mIProfcollect.trace_once("dex2oat");
                } catch (RemoteException | InterruptedException e) {
                } catch (RemoteException e) {
                    Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
                }
            });
            }, 1000);
        }
    }

@@ -394,15 +392,14 @@ public final class ProfcollectForwardingService extends SystemService {
                if (randomNum >= traceFrequency) {
                    return;
                }
                BackgroundThread.get().getThreadHandler().post(() -> {
                // Wait for 1s before starting tracing.
                BackgroundThread.get().getThreadHandler().postDelayed(() -> {
                    try {
                        // Wait for a short time before starting tracing.
                        Thread.sleep(1000);
                        mIProfcollect.trace_once("camera");
                    } catch (RemoteException | InterruptedException e) {
                    } catch (RemoteException e) {
                        Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
                    }
                });
                }, 1000);
            }
        }, null);
    }