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

Unified Diff: sky/shell/apk/src/org/domokit/sky/shell/SkyMain.java

Issue 893643002: Add a standalone SkyShell.apk for testing (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address reviewer comments Created 5 years, 11 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
« no previous file with comments | « sky/shell/apk/res/values/strings.xml ('k') | sky/shell/apk/src/org/domokit/sky/shell/SkyShellActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/apk/src/org/domokit/sky/shell/SkyMain.java
diff --git a/sky/shell/apk/src/org/domokit/sky/shell/SkyMain.java b/sky/shell/apk/src/org/domokit/sky/shell/SkyMain.java
new file mode 100644
index 0000000000000000000000000000000000000000..0f373e4026c88e9ebfb28003c2be7ec313b63d35
--- /dev/null
+++ b/sky/shell/apk/src/org/domokit/sky/shell/SkyMain.java
@@ -0,0 +1,50 @@
+// Copyright 2013 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.domokit.sky.shell;
+
+import android.content.Context;
+import android.util.Log;
+
+import org.chromium.base.JNINamespace;
+
+/**
+ * A class to intialize the native code.
+ **/
+@JNINamespace("sky::shell")
+public class SkyMain {
+ private static final String TAG = "SkyMain";
+
+ /**
+ * A guard flag for calling nativeInit() only once.
+ **/
+ private static boolean sInitialized = false;
+
+ /**
+ * Initializes the native system.
+ **/
+ static void ensureInitialized(Context applicationContext) {
+ if (sInitialized)
+ return;
+ try {
+ nativeInit(applicationContext);
+ sInitialized = true;
+ } catch (Exception e) {
+ Log.e(TAG, "SkyMain initialization failed.", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Starts the specified application in the specified context.
+ *
+ * @return <code>true</code> if an application has been launched.
+ **/
+ static boolean start() {
+ return nativeStart();
+ }
+
+ private static native void nativeInit(Context context);
+ private static native boolean nativeStart();
+}
« no previous file with comments | « sky/shell/apk/res/values/strings.xml ('k') | sky/shell/apk/src/org/domokit/sky/shell/SkyShellActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698