Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1573)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java

Issue 2719493003: Add PhysicalWebBroadcastService (Closed)
Patch Set: rebasing with master Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b4a14a2044cb381514cfaadf5ad74e14cc145f1
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBroadcastService.java
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.physicalweb;
+
+import android.annotation.TargetApi;
+import android.app.Service;
+import android.content.Intent;
+import android.os.Build;
+import android.os.IBinder;
+
+/**
+ * Broadcasts Physical Web URLs via BLE.
+ **/
+// bluetooth.le.AdvertiseCallback and bluetooth.BluetoothAdapter require API level 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.
+// This will only be run on M and above.
+@TargetApi(Build.VERSION_CODES.LOLLIPOP)
+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
+ public static final String DISPLAY_URL_KEY = "display_url";
+
+ @Override
+ 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
+ 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.
+ // 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.
+ if (displayUrl == null) {
+ stopSelf();
+ return START_STICKY;
+ }
+ // 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.
+ stopSelf();
+ 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
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698