2010-06-03 13:56:36 -07:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Android code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Vladimir Vukicevic <vladimir@pobox.com>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef AndroidBridge_h__
|
|
|
|
#define AndroidBridge_h__
|
|
|
|
|
|
|
|
#include <jni.h>
|
|
|
|
#include <android/log.h>
|
2011-11-14 19:12:14 -08:00
|
|
|
#include <cstdlib>
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2011-09-16 14:34:31 -07:00
|
|
|
#include "nsCOMArray.h"
|
2010-06-03 13:56:36 -07:00
|
|
|
#include "nsIRunnable.h"
|
2010-06-14 19:17:37 -07:00
|
|
|
#include "nsIObserver.h"
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
#include "AndroidJavaWrappers.h"
|
|
|
|
|
2010-09-30 08:37:36 -07:00
|
|
|
#include "nsIMutableArray.h"
|
|
|
|
#include "nsIMIMEInfo.h"
|
2011-03-30 11:04:41 -07:00
|
|
|
#include "nsColor.h"
|
2010-06-14 12:04:16 -07:00
|
|
|
|
2011-11-14 19:12:14 -08:00
|
|
|
#include "nsIAndroidBridge.h"
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
// Some debug #defines
|
2011-08-29 11:29:39 -07:00
|
|
|
// #define DEBUG_ANDROID_EVENTS
|
|
|
|
// #define DEBUG_ANDROID_WIDGET
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
class nsWindow;
|
2012-01-13 05:25:47 -08:00
|
|
|
class nsIDOMMozSmsMessage;
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2011-11-02 08:35:11 -07:00
|
|
|
namespace hal {
|
|
|
|
class BatteryInformation;
|
|
|
|
} // namespace hal
|
|
|
|
|
2011-03-30 11:04:41 -07:00
|
|
|
// The order and number of the members in this structure must correspond
|
|
|
|
// to the attrsAppearance array in GeckoAppShell.getSystemColors()
|
|
|
|
typedef struct AndroidSystemColors {
|
|
|
|
nscolor textColorPrimary;
|
|
|
|
nscolor textColorPrimaryInverse;
|
|
|
|
nscolor textColorSecondary;
|
|
|
|
nscolor textColorSecondaryInverse;
|
|
|
|
nscolor textColorTertiary;
|
|
|
|
nscolor textColorTertiaryInverse;
|
|
|
|
nscolor textColorHighlight;
|
|
|
|
nscolor colorForeground;
|
|
|
|
nscolor colorBackground;
|
|
|
|
nscolor panelColorForeground;
|
|
|
|
nscolor panelColorBackground;
|
|
|
|
} AndroidSystemColors;
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
class AndroidBridge
|
|
|
|
{
|
|
|
|
public:
|
2010-08-04 12:47:26 -07:00
|
|
|
enum {
|
|
|
|
NOTIFY_IME_RESETINPUTSTATE = 0,
|
|
|
|
NOTIFY_IME_SETOPENSTATE = 1,
|
2010-11-22 22:48:25 -08:00
|
|
|
NOTIFY_IME_CANCELCOMPOSITION = 2,
|
|
|
|
NOTIFY_IME_FOCUSCHANGE = 3
|
2010-08-04 12:47:26 -07:00
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
static AndroidBridge *ConstructBridge(JNIEnv *jEnv,
|
|
|
|
jclass jGeckoAppShellClass);
|
|
|
|
|
|
|
|
static AndroidBridge *Bridge() {
|
|
|
|
return sBridge;
|
|
|
|
}
|
|
|
|
|
|
|
|
static JavaVM *VM() {
|
|
|
|
return sBridge->mJavaVM;
|
|
|
|
}
|
|
|
|
|
|
|
|
static JNIEnv *JNI() {
|
|
|
|
sBridge->EnsureJNIThread();
|
|
|
|
return sBridge->mJNIEnv;
|
|
|
|
}
|
|
|
|
|
|
|
|
static JNIEnv *JNIForThread() {
|
2010-09-22 18:03:46 -07:00
|
|
|
if (NS_LIKELY(sBridge))
|
|
|
|
return sBridge->AttachThread();
|
|
|
|
return nsnull;
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
2010-10-15 11:16:45 -07:00
|
|
|
|
|
|
|
static jclass GetGeckoAppShellClass() {
|
|
|
|
return sBridge->mGeckoAppShellClass;
|
|
|
|
}
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
// The bridge needs to be constructed via ConstructBridge first,
|
|
|
|
// and then once the Gecko main thread is spun up (Gecko side),
|
|
|
|
// SetMainThread should be called which will create the JNIEnv for
|
|
|
|
// us to use. toolkit/xre/nsAndroidStartup.cpp calls
|
|
|
|
// SetMainThread.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool SetMainThread(void *thr);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
JNIEnv* AttachThread(bool asDaemon = true);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
/* These are all implemented in Java */
|
2010-08-05 11:11:32 -07:00
|
|
|
static void NotifyIME(int aType, int aState);
|
2010-08-04 12:47:26 -07:00
|
|
|
|
2010-11-23 18:12:53 -08:00
|
|
|
static void NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
|
|
|
|
const nsAString& aActionHint);
|
2010-11-22 22:48:25 -08:00
|
|
|
|
2010-08-05 11:11:32 -07:00
|
|
|
static void NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen, int aStart, int aEnd, int aNewEnd);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2011-03-02 09:23:02 -08:00
|
|
|
void AcknowledgeEventSync();
|
|
|
|
|
2011-06-19 22:36:17 -07:00
|
|
|
void EnableDeviceMotion(bool aEnable);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
2010-06-04 14:14:43 -07:00
|
|
|
void EnableLocation(bool aEnable);
|
|
|
|
|
2010-08-04 12:47:26 -07:00
|
|
|
void ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen, int aSelStart, int aSelLen);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
void NotifyXreExit();
|
|
|
|
|
|
|
|
void ScheduleRestart();
|
|
|
|
|
2011-11-14 19:12:14 -08:00
|
|
|
void SetSoftwareLayerClient(jobject jobj);
|
|
|
|
AndroidGeckoSoftwareLayerClient &GetSoftwareLayerClient() { return mSoftwareLayerClient; }
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
void SetSurfaceView(jobject jobj);
|
|
|
|
AndroidGeckoSurfaceView& SurfaceView() { return mSurfaceView; }
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetHandlersForURL(const char *aURL,
|
2010-11-23 15:40:46 -08:00
|
|
|
nsIMutableArray* handlersArray = nsnull,
|
|
|
|
nsIHandlerApp **aDefaultApp = nsnull,
|
|
|
|
const nsAString& aAction = EmptyString());
|
2010-06-14 12:04:16 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetHandlersForMimeType(const char *aMimeType,
|
2010-09-30 08:37:36 -07:00
|
|
|
nsIMutableArray* handlersArray = nsnull,
|
|
|
|
nsIHandlerApp **aDefaultApp = nsnull,
|
|
|
|
const nsAString& aAction = EmptyString());
|
2010-06-29 19:22:08 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool OpenUriExternal(const nsACString& aUriSpec, const nsACString& aMimeType,
|
2010-10-01 18:04:23 -07:00
|
|
|
const nsAString& aPackageName = EmptyString(),
|
2010-09-30 08:37:36 -07:00
|
|
|
const nsAString& aClassName = EmptyString(),
|
2010-10-01 18:04:23 -07:00
|
|
|
const nsAString& aAction = EmptyString(),
|
|
|
|
const nsAString& aTitle = EmptyString());
|
2010-06-14 12:04:16 -07:00
|
|
|
|
2010-11-05 10:43:12 -07:00
|
|
|
void GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString& aMimeType);
|
2011-09-15 00:40:17 -07:00
|
|
|
void GetExtensionFromMimeType(const nsACString& aMimeType, nsACString& aFileExt);
|
2010-06-14 12:04:16 -07:00
|
|
|
|
2010-06-16 10:20:54 -07:00
|
|
|
void MoveTaskToBack();
|
|
|
|
|
2010-08-26 16:43:23 -07:00
|
|
|
bool GetClipboardText(nsAString& aText);
|
|
|
|
|
|
|
|
void SetClipboardText(const nsAString& aText);
|
|
|
|
|
|
|
|
void EmptyClipboard();
|
|
|
|
|
|
|
|
bool ClipboardHasText();
|
|
|
|
|
2010-06-14 19:17:37 -07:00
|
|
|
void ShowAlertNotification(const nsAString& aImageUrl,
|
|
|
|
const nsAString& aAlertTitle,
|
|
|
|
const nsAString& aAlertText,
|
|
|
|
const nsAString& aAlertData,
|
|
|
|
nsIObserver *aAlertListener,
|
|
|
|
const nsAString& aAlertName);
|
|
|
|
|
2010-10-01 14:21:21 -07:00
|
|
|
void AlertsProgressListener_OnProgress(const nsAString& aAlertName,
|
|
|
|
PRInt64 aProgress,
|
|
|
|
PRInt64 aProgressMax,
|
|
|
|
const nsAString& aAlertText);
|
|
|
|
|
2010-10-12 19:17:12 -07:00
|
|
|
void AlertsProgressListener_OnCancel(const nsAString& aAlertName);
|
|
|
|
|
2010-10-07 10:28:27 -07:00
|
|
|
int GetDPI();
|
|
|
|
|
2010-11-05 10:43:12 -07:00
|
|
|
void ShowFilePicker(nsAString& aFilePath, nsAString& aFilters);
|
2010-09-30 08:37:36 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void PerformHapticFeedback(bool aIsLongPress);
|
2010-11-22 08:38:02 -08:00
|
|
|
|
2011-09-30 00:00:48 -07:00
|
|
|
void Vibrate(const nsTArray<PRUint32>& aPattern);
|
|
|
|
void CancelVibrate();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void SetFullScreen(bool aFullScreen);
|
2010-11-08 18:11:13 -08:00
|
|
|
|
2010-11-10 06:40:00 -08:00
|
|
|
void ShowInputMethodPicker();
|
|
|
|
|
2010-11-12 12:02:14 -08:00
|
|
|
void HideProgressDialogOnce();
|
|
|
|
|
2011-01-20 03:06:13 -08:00
|
|
|
bool IsNetworkLinkUp();
|
|
|
|
|
|
|
|
bool IsNetworkLinkKnown();
|
|
|
|
|
2011-03-16 16:17:59 -07:00
|
|
|
void SetSelectedLocale(const nsAString&);
|
2011-02-27 07:50:56 -08:00
|
|
|
|
2011-03-30 11:04:41 -07:00
|
|
|
void GetSystemColors(AndroidSystemColors *aColors);
|
|
|
|
|
2011-06-13 14:02:13 -07:00
|
|
|
void GetIconForExtension(const nsACString& aFileExt, PRUint32 aIconSize, PRUint8 * const aBuf);
|
|
|
|
|
2011-07-26 18:14:52 -07:00
|
|
|
bool GetShowPasswordSetting();
|
|
|
|
|
2011-08-04 00:32:57 -07:00
|
|
|
void FireAndWaitForTracerEvent();
|
|
|
|
|
2011-11-14 19:12:14 -08:00
|
|
|
bool GetAccessibilityEnabled();
|
|
|
|
|
2011-11-29 08:34:52 -08:00
|
|
|
class AutoLocalJNIFrame {
|
|
|
|
public:
|
|
|
|
AutoLocalJNIFrame(int nEntries = 128)
|
|
|
|
: mEntries(nEntries)
|
|
|
|
, mJNIEnv(JNI())
|
|
|
|
{
|
|
|
|
Push();
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
2011-11-29 08:34:52 -08:00
|
|
|
|
|
|
|
AutoLocalJNIFrame(JNIEnv* aJNIEnv, int nEntries = 128)
|
|
|
|
: mEntries(nEntries)
|
|
|
|
, mJNIEnv(aJNIEnv ? aJNIEnv : JNI())
|
|
|
|
{
|
|
|
|
Push();
|
|
|
|
}
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
// Note! Calling Purge makes all previous local refs created in
|
|
|
|
// the AutoLocalJNIFrame's scope INVALID; be sure that you locked down
|
|
|
|
// any local refs that you need to keep around in global refs!
|
|
|
|
void Purge() {
|
2011-11-29 08:34:52 -08:00
|
|
|
mJNIEnv->PopLocalFrame(NULL);
|
|
|
|
Push();
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
2011-11-29 08:34:52 -08:00
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
~AutoLocalJNIFrame() {
|
2011-11-29 08:34:52 -08:00
|
|
|
jthrowable exception = mJNIEnv->ExceptionOccurred();
|
2010-11-20 13:09:24 -08:00
|
|
|
if (exception) {
|
2011-11-29 08:34:52 -08:00
|
|
|
mJNIEnv->ExceptionDescribe();
|
|
|
|
mJNIEnv->ExceptionClear();
|
2010-11-20 13:09:24 -08:00
|
|
|
}
|
2011-11-29 08:34:52 -08:00
|
|
|
|
|
|
|
mJNIEnv->PopLocalFrame(NULL);
|
2010-06-03 13:56:36 -07:00
|
|
|
}
|
2011-11-29 08:34:52 -08:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Push() {
|
|
|
|
// Make sure there is enough space to store a local ref to the
|
|
|
|
// exception. I am not completely sure this is needed, but does
|
|
|
|
// not hurt.
|
|
|
|
mJNIEnv->PushLocalFrame(mEntries + 1);
|
|
|
|
}
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
int mEntries;
|
2011-11-29 08:34:52 -08:00
|
|
|
JNIEnv* mJNIEnv;
|
2010-06-03 13:56:36 -07:00
|
|
|
};
|
|
|
|
|
2010-06-25 17:52:37 -07:00
|
|
|
/* See GLHelpers.java as to why this is needed */
|
|
|
|
void *CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoSurfaceView& surfaceView);
|
|
|
|
|
2010-09-11 06:20:20 -07:00
|
|
|
bool GetStaticStringField(const char *classID, const char *field, nsAString &result);
|
|
|
|
|
2011-02-28 08:32:05 -08:00
|
|
|
bool GetStaticIntField(const char *className, const char *fieldName, PRInt32* aInt);
|
|
|
|
|
2010-12-21 14:34:29 -08:00
|
|
|
void SetKeepScreenOn(bool on);
|
|
|
|
|
2011-04-08 10:52:13 -07:00
|
|
|
void ScanMedia(const nsAString& aFile, const nsACString& aMimeType);
|
|
|
|
|
2011-08-08 19:37:57 -07:00
|
|
|
void CreateShortcut(const nsAString& aTitle, const nsAString& aURI, const nsAString& aIconData, const nsAString& aIntent);
|
|
|
|
|
2011-06-16 02:03:00 -07:00
|
|
|
// These next four functions are for native Bitmap access in Android 2.2+
|
|
|
|
bool HasNativeBitmapAccess();
|
|
|
|
|
|
|
|
bool ValidateBitmap(jobject bitmap, int width, int height);
|
|
|
|
|
|
|
|
void *LockBitmap(jobject bitmap);
|
|
|
|
|
|
|
|
void UnlockBitmap(jobject bitmap);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void PostToJavaThread(nsIRunnable* aRunnable, bool aMainThread = false);
|
2011-09-16 14:34:31 -07:00
|
|
|
|
|
|
|
void ExecuteNextRunnable();
|
|
|
|
|
2011-09-21 09:46:00 -07:00
|
|
|
/* Copied from Android's native_window.h in newer (platform 9) NDK */
|
|
|
|
enum {
|
|
|
|
WINDOW_FORMAT_RGBA_8888 = 1,
|
|
|
|
WINDOW_FORMAT_RGBX_8888 = 2,
|
|
|
|
WINDOW_FORMAT_RGB_565 = 4,
|
|
|
|
};
|
|
|
|
|
|
|
|
bool HasNativeWindowAccess();
|
|
|
|
|
|
|
|
void *AcquireNativeWindow(jobject surface);
|
|
|
|
void ReleaseNativeWindow(void *window);
|
|
|
|
bool SetNativeWindowFormat(void *window, int format);
|
|
|
|
|
|
|
|
bool LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride);
|
|
|
|
bool UnlockWindow(void *window);
|
2011-11-14 19:12:14 -08:00
|
|
|
|
|
|
|
void HandleGeckoMessage(const nsAString& message, nsAString &aRet);
|
|
|
|
|
2011-11-17 19:20:29 -08:00
|
|
|
nsCOMPtr<nsIAndroidDrawMetadataProvider> GetDrawMetadataProvider();
|
|
|
|
|
2011-11-14 19:12:14 -08:00
|
|
|
void EmitGeckoAccessibilityEvent (PRInt32 eventType, const nsAString& role, const nsAString& text, const nsAString& description, bool enabled, bool checked, bool password);
|
|
|
|
|
|
|
|
void CheckURIVisited(const nsAString& uri);
|
|
|
|
void MarkURIVisited(const nsAString& uri);
|
2011-09-21 09:46:00 -07:00
|
|
|
|
2011-09-26 17:25:41 -07:00
|
|
|
bool InitCamera(const nsCString& contentType, PRUint32 camera, PRUint32 *width, PRUint32 *height, PRUint32 *fps);
|
|
|
|
|
|
|
|
void CloseCamera();
|
|
|
|
|
2011-11-02 08:35:11 -07:00
|
|
|
void EnableBatteryNotifications();
|
|
|
|
void DisableBatteryNotifications();
|
|
|
|
void GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo);
|
|
|
|
|
2011-11-25 01:48:51 -08:00
|
|
|
PRUint16 GetNumberOfMessagesForText(const nsAString& aText);
|
2011-11-20 15:00:46 -08:00
|
|
|
void SendMessage(const nsAString& aNumber, const nsAString& aText);
|
2012-01-13 05:25:47 -08:00
|
|
|
PRInt32 SaveSentMessage(const nsAString& aRecipient, const nsAString& aBody, PRUint64 aDate);
|
2011-11-25 01:48:51 -08:00
|
|
|
|
2011-12-14 13:53:38 -08:00
|
|
|
bool IsTablet();
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
protected:
|
|
|
|
static AndroidBridge *sBridge;
|
|
|
|
|
|
|
|
// the global JavaVM
|
|
|
|
JavaVM *mJavaVM;
|
|
|
|
|
|
|
|
// the JNIEnv for the main thread
|
|
|
|
JNIEnv *mJNIEnv;
|
|
|
|
void *mThread;
|
|
|
|
|
|
|
|
// the GeckoSurfaceView
|
|
|
|
AndroidGeckoSurfaceView mSurfaceView;
|
2011-11-14 19:12:14 -08:00
|
|
|
AndroidGeckoSoftwareLayerClient mSoftwareLayerClient;
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
// the GeckoAppShell java class
|
|
|
|
jclass mGeckoAppShellClass;
|
|
|
|
|
|
|
|
AndroidBridge() { }
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Init(JNIEnv *jEnv, jclass jGeckoApp);
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
void EnsureJNIThread();
|
|
|
|
|
2011-09-21 09:46:00 -07:00
|
|
|
bool mOpenedGraphicsLibraries;
|
|
|
|
void OpenGraphicsLibraries();
|
|
|
|
|
2011-06-16 02:03:00 -07:00
|
|
|
bool mHasNativeBitmapAccess;
|
2011-09-21 09:46:00 -07:00
|
|
|
bool mHasNativeWindowAccess;
|
2011-06-16 02:03:00 -07:00
|
|
|
|
2011-09-16 14:34:31 -07:00
|
|
|
nsCOMArray<nsIRunnable> mRunnableQueue;
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
// other things
|
2010-08-04 12:47:26 -07:00
|
|
|
jmethodID jNotifyIME;
|
2010-11-22 22:48:25 -08:00
|
|
|
jmethodID jNotifyIMEEnabled;
|
2010-08-04 12:47:26 -07:00
|
|
|
jmethodID jNotifyIMEChange;
|
2011-03-02 09:23:02 -08:00
|
|
|
jmethodID jAcknowledgeEventSync;
|
2011-06-19 22:36:17 -07:00
|
|
|
jmethodID jEnableDeviceMotion;
|
2010-06-04 14:14:43 -07:00
|
|
|
jmethodID jEnableLocation;
|
2010-06-03 13:56:36 -07:00
|
|
|
jmethodID jReturnIMEQueryResult;
|
2010-10-25 20:10:07 -07:00
|
|
|
jmethodID jNotifyAppShellReady;
|
2010-06-03 13:56:36 -07:00
|
|
|
jmethodID jNotifyXreExit;
|
|
|
|
jmethodID jScheduleRestart;
|
|
|
|
jmethodID jGetOutstandingDrawEvents;
|
2010-06-14 12:04:16 -07:00
|
|
|
jmethodID jGetHandlersForMimeType;
|
2010-11-23 15:40:46 -08:00
|
|
|
jmethodID jGetHandlersForURL;
|
2010-06-14 12:04:16 -07:00
|
|
|
jmethodID jOpenUriExternal;
|
2010-11-05 10:43:12 -07:00
|
|
|
jmethodID jGetMimeTypeFromExtensions;
|
2011-03-07 21:45:43 -08:00
|
|
|
jmethodID jGetExtensionFromMimeType;
|
2010-06-16 10:20:54 -07:00
|
|
|
jmethodID jMoveTaskToBack;
|
2010-08-26 16:43:23 -07:00
|
|
|
jmethodID jGetClipboardText;
|
|
|
|
jmethodID jSetClipboardText;
|
2010-06-14 19:17:37 -07:00
|
|
|
jmethodID jShowAlertNotification;
|
2010-09-30 08:37:36 -07:00
|
|
|
jmethodID jShowFilePicker;
|
2010-10-01 14:21:21 -07:00
|
|
|
jmethodID jAlertsProgressListener_OnProgress;
|
2010-10-12 19:17:12 -07:00
|
|
|
jmethodID jAlertsProgressListener_OnCancel;
|
2010-10-07 10:28:27 -07:00
|
|
|
jmethodID jGetDpi;
|
2010-11-08 18:11:13 -08:00
|
|
|
jmethodID jSetFullScreen;
|
2010-11-10 06:40:00 -08:00
|
|
|
jmethodID jShowInputMethodPicker;
|
2010-11-12 12:02:14 -08:00
|
|
|
jmethodID jHideProgressDialog;
|
2010-11-22 08:38:02 -08:00
|
|
|
jmethodID jPerformHapticFeedback;
|
2011-09-30 00:00:48 -07:00
|
|
|
jmethodID jVibrate1;
|
|
|
|
jmethodID jVibrateA;
|
|
|
|
jmethodID jCancelVibrate;
|
2010-12-21 14:34:29 -08:00
|
|
|
jmethodID jSetKeepScreenOn;
|
2011-01-20 03:06:13 -08:00
|
|
|
jmethodID jIsNetworkLinkUp;
|
|
|
|
jmethodID jIsNetworkLinkKnown;
|
2011-02-27 07:50:56 -08:00
|
|
|
jmethodID jSetSelectedLocale;
|
2011-04-08 10:52:13 -07:00
|
|
|
jmethodID jScanMedia;
|
2011-03-30 11:04:41 -07:00
|
|
|
jmethodID jGetSystemColors;
|
2011-06-13 14:02:13 -07:00
|
|
|
jmethodID jGetIconForExtension;
|
2011-08-04 00:32:57 -07:00
|
|
|
jmethodID jFireAndWaitForTracerEvent;
|
2011-08-08 19:37:57 -07:00
|
|
|
jmethodID jCreateShortcut;
|
2011-07-26 18:14:52 -07:00
|
|
|
jmethodID jGetShowPasswordSetting;
|
2011-09-16 14:34:31 -07:00
|
|
|
jmethodID jPostToJavaThread;
|
2011-09-26 17:25:41 -07:00
|
|
|
jmethodID jInitCamera;
|
|
|
|
jmethodID jCloseCamera;
|
2011-12-14 13:53:38 -08:00
|
|
|
jmethodID jIsTablet;
|
2011-11-02 08:35:11 -07:00
|
|
|
jmethodID jEnableBatteryNotifications;
|
|
|
|
jmethodID jDisableBatteryNotifications;
|
|
|
|
jmethodID jGetCurrentBatteryInformation;
|
2011-11-14 19:12:14 -08:00
|
|
|
jmethodID jGetAccessibilityEnabled;
|
|
|
|
jmethodID jHandleGeckoMessage;
|
|
|
|
jmethodID jCheckUriVisited;
|
|
|
|
jmethodID jMarkUriVisited;
|
|
|
|
jmethodID jEmitGeckoAccessibilityEvent;
|
2010-06-25 17:52:37 -07:00
|
|
|
|
2011-11-25 01:48:51 -08:00
|
|
|
jmethodID jNumberOfMessages;
|
2011-11-20 15:00:46 -08:00
|
|
|
jmethodID jSendMessage;
|
2012-01-13 05:25:47 -08:00
|
|
|
jmethodID jSaveSentMessage;
|
2010-06-25 17:52:37 -07:00
|
|
|
|
|
|
|
// stuff we need for CallEglCreateWindowSurface
|
|
|
|
jclass jEGLSurfaceImplClass;
|
|
|
|
jclass jEGLContextImplClass;
|
|
|
|
jclass jEGLConfigImplClass;
|
|
|
|
jclass jEGLDisplayImplClass;
|
|
|
|
jclass jEGLContextClass;
|
|
|
|
jclass jEGL10Class;
|
2011-06-16 02:03:00 -07:00
|
|
|
|
|
|
|
// calls we've dlopened from libjnigraphics.so
|
|
|
|
int (* AndroidBitmap_getInfo)(JNIEnv *env, jobject bitmap, void *info);
|
|
|
|
int (* AndroidBitmap_lockPixels)(JNIEnv *env, jobject bitmap, void **buffer);
|
|
|
|
int (* AndroidBitmap_unlockPixels)(JNIEnv *env, jobject bitmap);
|
2011-09-21 09:46:00 -07:00
|
|
|
|
|
|
|
void* (*ANativeWindow_fromSurface)(JNIEnv *env, jobject surface);
|
|
|
|
void (*ANativeWindow_release)(void *window);
|
|
|
|
int (*ANativeWindow_setBuffersGeometry)(void *window, int width, int height, int format);
|
|
|
|
|
|
|
|
int (* ANativeWindow_lock)(void *window, void *outBuffer, void *inOutDirtyBounds);
|
|
|
|
int (* ANativeWindow_unlockAndPost)(void *window);
|
2010-06-03 13:56:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-11-14 19:12:14 -08:00
|
|
|
#define NS_ANDROIDBRIDGE_CID \
|
|
|
|
{ 0x0FE2321D, 0xEBD9, 0x467D, \
|
|
|
|
{ 0xA7, 0x43, 0x03, 0xA6, 0x8D, 0x40, 0x59, 0x9E } }
|
|
|
|
|
|
|
|
class nsAndroidBridge : public nsIAndroidBridge
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIANDROIDBRIDGE
|
|
|
|
|
|
|
|
nsAndroidBridge();
|
|
|
|
|
|
|
|
private:
|
|
|
|
~nsAndroidBridge();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
};
|
|
|
|
|
2010-06-03 13:56:36 -07:00
|
|
|
extern "C" JNIEnv * GetJNIForThread();
|
2011-09-28 23:19:26 -07:00
|
|
|
extern bool mozilla_AndroidBridge_SetMainThread(void *);
|
2010-10-15 11:16:45 -07:00
|
|
|
extern jclass GetGeckoAppShellClass();
|
2010-06-03 13:56:36 -07:00
|
|
|
|
|
|
|
#endif /* AndroidBridge_h__ */
|