Loading core/java/android/view/ViewRootImpl.java +24 −37 Original line number Diff line number Diff line Loading @@ -304,6 +304,7 @@ import java.util.OptionalInt; import java.util.Queue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Predicate; /** Loading Loading @@ -1201,8 +1202,7 @@ public final class ViewRootImpl implements ViewParent, private String mLargestViewTraceName; private final boolean mAppStartInfoTimestampsFlagValue; @GuardedBy("this") private boolean mAppStartTimestampsSent = false; private AtomicBoolean mAppStartTimestampsSent = new AtomicBoolean(false); private boolean mAppStartTrackingStarted = false; private long mRenderThreadDrawStartTimeNs = -1; private long mFirstFramePresentedTimeNs = -1; Loading Loading @@ -2647,7 +2647,7 @@ public final class ViewRootImpl implements ViewParent, destroySurface(); // Reset so they can be sent again for warm starts. mAppStartTimestampsSent = false; mAppStartTimestampsSent.set(false); mAppStartTrackingStarted = false; mRenderThreadDrawStartTimeNs = -1; mFirstFramePresentedTimeNs = -1; Loading Loading @@ -4503,43 +4503,30 @@ public final class ViewRootImpl implements ViewParent, } private void maybeSendAppStartTimes() { synchronized (this) { if (mAppStartTimestampsSent) { if (mAppStartTimestampsSent.get()) { // Don't send timestamps more than once. return; } // If we already have {@link mRenderThreadDrawStartTimeNs} then pass it through, if not // post to main thread and check if we have it there. if (mRenderThreadDrawStartTimeNs != -1) { sendAppStartTimesLocked(); } else { // Post to main thread mHandler.post(new Runnable() { @Override public void run() { synchronized (ViewRootImpl.this) { if (mRenderThreadDrawStartTimeNs == -1) { return; } sendAppStartTimesLocked(); } } }); } } } @GuardedBy("this") private void sendAppStartTimesLocked() { try { ActivityManager.getService().reportStartInfoViewTimestamps( mRenderThreadDrawStartTimeNs, mFirstFramePresentedTimeNs); mAppStartTimestampsSent = true; mAppStartTimestampsSent.set(true); } catch (RemoteException e) { // Ignore, timestamps may be lost. if (DBG) Log.d(TAG, "Exception attempting to report start timestamps.", e); } } }); } /** * Helper used to notify the service to block projection when a sensitive Loading Loading
core/java/android/view/ViewRootImpl.java +24 −37 Original line number Diff line number Diff line Loading @@ -304,6 +304,7 @@ import java.util.OptionalInt; import java.util.Queue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Consumer; import java.util.function.Predicate; /** Loading Loading @@ -1201,8 +1202,7 @@ public final class ViewRootImpl implements ViewParent, private String mLargestViewTraceName; private final boolean mAppStartInfoTimestampsFlagValue; @GuardedBy("this") private boolean mAppStartTimestampsSent = false; private AtomicBoolean mAppStartTimestampsSent = new AtomicBoolean(false); private boolean mAppStartTrackingStarted = false; private long mRenderThreadDrawStartTimeNs = -1; private long mFirstFramePresentedTimeNs = -1; Loading Loading @@ -2647,7 +2647,7 @@ public final class ViewRootImpl implements ViewParent, destroySurface(); // Reset so they can be sent again for warm starts. mAppStartTimestampsSent = false; mAppStartTimestampsSent.set(false); mAppStartTrackingStarted = false; mRenderThreadDrawStartTimeNs = -1; mFirstFramePresentedTimeNs = -1; Loading Loading @@ -4503,43 +4503,30 @@ public final class ViewRootImpl implements ViewParent, } private void maybeSendAppStartTimes() { synchronized (this) { if (mAppStartTimestampsSent) { if (mAppStartTimestampsSent.get()) { // Don't send timestamps more than once. return; } // If we already have {@link mRenderThreadDrawStartTimeNs} then pass it through, if not // post to main thread and check if we have it there. if (mRenderThreadDrawStartTimeNs != -1) { sendAppStartTimesLocked(); } else { // Post to main thread mHandler.post(new Runnable() { @Override public void run() { synchronized (ViewRootImpl.this) { if (mRenderThreadDrawStartTimeNs == -1) { return; } sendAppStartTimesLocked(); } } }); } } } @GuardedBy("this") private void sendAppStartTimesLocked() { try { ActivityManager.getService().reportStartInfoViewTimestamps( mRenderThreadDrawStartTimeNs, mFirstFramePresentedTimeNs); mAppStartTimestampsSent = true; mAppStartTimestampsSent.set(true); } catch (RemoteException e) { // Ignore, timestamps may be lost. if (DBG) Log.d(TAG, "Exception attempting to report start timestamps.", e); } } }); } /** * Helper used to notify the service to block projection when a sensitive Loading