OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.chrome.browser.physicalweb; | |
6 | |
7 import android.annotation.TargetApi; | |
8 import android.app.Service; | |
9 import android.content.Intent; | |
10 import android.os.Build; | |
11 import android.os.IBinder; | |
12 | |
13 /** | |
14 * Broadcasts Physical Web URLs via BLE. | |
15 **/ | |
16 // bluetooth.le.AdvertiseCallback and bluetooth.BluetoothAdapter require API lev el 21. | |
nyquist
2017/03/06 22:34:13
Why is this a separate style of comment than the j
iankc
2017/03/07 02:10:39
Done.
| |
17 // This will only be run on M and above. | |
18 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
19 public class PhysicalWebBroadcastService extends Service { | |
nyquist
2017/03/06 22:34:13
If there is an upper limit for how long time this
iankc
2017/03/07 02:10:39
There is no upper limit for how long it will be ru
| |
20 public static final String DISPLAY_URL_KEY = "display_url"; | |
21 | |
22 @Override | |
23 public int onStartCommand(Intent intent, int flags, int startId) { | |
nyquist
2017/03/06 22:34:13
Will this be a foreground service?
iankc
2017/03/07 02:10:39
This is not a foreground service. It is a backgrou
| |
24 String displayUrl = intent.getStringExtra(DISPLAY_URL_KEY); | |
nyquist
2017/03/06 22:34:13
This will crash if there are no pending start-comm
iankc
2017/03/07 02:10:39
Done.
| |
25 // This should never happen. | |
nyquist
2017/03/06 22:34:13
Can you add a newline before this line?
iankc
2017/03/07 02:10:39
Done.
| |
26 if (displayUrl == null) { | |
27 stopSelf(); | |
28 return START_STICKY; | |
29 } | |
30 // TODO(iankc): implement parsing, broadcasting, and notifications. | |
nyquist
2017/03/06 22:34:13
Can you add a newline before this line to separate
iankc
2017/03/07 02:10:39
Done.
| |
31 stopSelf(); | |
32 return START_STICKY; | |
nyquist
2017/03/06 22:34:13
Can you expand the JavaDoc for the whole class qui
iankc
2017/03/07 02:10:39
I feel like I did all of this besides the guarante
| |
33 } | |
34 | |
35 @Override | |
36 public IBinder onBind(Intent intent) { | |
37 return null; | |
38 } | |
39 } | |
OLD | NEW |