Skip to content

Commit e569faa

Browse files
committed
Comments and readability clean up
1 parent ade1621 commit e569faa

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignalPrefs.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class OneSignalPrefs {
123123
}
124124

125125
public static class WritePrefHandlerThread extends HandlerThread {
126-
private Handler mHandler;
126+
private @Nullable Handler mHandler;
127127

128128
private static final int WRITE_CALL_DELAY_TO_BUFFER_MS = 200;
129129
private long lastSyncTime = 0L;
@@ -136,9 +136,11 @@ public static class WritePrefHandlerThread extends HandlerThread {
136136
protected void onLooperPrepared() {
137137
super.onLooperPrepared();
138138

139-
// Getting handler here as onLooperPrepared guarantees getLooper() will not return null
139+
// Getting handler here as onLooperPrepared guarantees getLooper() will be non-null
140140
mHandler = new Handler(getLooper());
141-
scheduleFlushToDiskJob();
141+
142+
// Kicks off our first flush, startDelayedWrite will schedule all flushes after that
143+
scheduleFlushToDisk();
142144
}
143145

144146
private synchronized void startDelayedWrite() {
@@ -148,7 +150,7 @@ private synchronized void startDelayedWrite() {
148150
return;
149151

150152
startThread();
151-
scheduleFlushToDiskJob();
153+
scheduleFlushToDisk();
152154
}
153155

154156
private boolean threadStartCalled;
@@ -160,7 +162,7 @@ private void startThread() {
160162
threadStartCalled = true;
161163
}
162164

163-
private synchronized void scheduleFlushToDiskJob() {
165+
private synchronized void scheduleFlushToDisk() {
164166
// Could be null if looper thread just started
165167
if (mHandler == null)
166168
return;

0 commit comments

Comments
 (0)