mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 07:05:24 +00:00
Bug 913985: Part 1 - Introduce a nicer annotation API for the generator, and migrate all existing annotations to it. r=kats
--HG-- rename : mobile/android/base/mozglue/OptionalGeneratedParameter.java => mobile/android/base/mozglue/generatorannotations/OptionalGeneratedParameter.java rename : mobile/android/base/mozglue/GeneratableAndroidBridgeTarget.java => mobile/android/base/mozglue/generatorannotations/WrapElementForJNI.java
This commit is contained in:
parent
b7c2e6c8f6
commit
32f9134f91
@ -11,8 +11,8 @@ import org.mozilla.gecko.gfx.GfxInfoThread;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.gfx.PanZoomController;
|
||||
import org.mozilla.gecko.mozglue.GeckoLoader;
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.OptionalGeneratedParameter;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.OptionalGeneratedParameter;
|
||||
import org.mozilla.gecko.util.EventDispatcher;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
@ -373,14 +373,14 @@ public class GeckoAppShell
|
||||
/*
|
||||
* The Gecko-side API: API methods that Gecko calls
|
||||
*/
|
||||
@GeneratableAndroidBridgeTarget(generateStatic = true)
|
||||
@WrapElementForJNI(generateStatic = true)
|
||||
public static void notifyIME(int type) {
|
||||
if (mEditableListener != null) {
|
||||
mEditableListener.notifyIME(type);
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(generateStatic = true)
|
||||
@WrapElementForJNI(generateStatic = true)
|
||||
public static void notifyIMEContext(int state, String typeHint,
|
||||
String modeHint, String actionHint) {
|
||||
if (mEditableListener != null) {
|
||||
@ -389,7 +389,7 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(generateStatic = true)
|
||||
@WrapElementForJNI(generateStatic = true)
|
||||
public static void notifyIMEChange(String text, int start, int end, int newEnd) {
|
||||
if (newEnd < 0) { // Selection change
|
||||
mEditableListener.onSelectionChange(start, end);
|
||||
@ -433,7 +433,7 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
// Signal the Java thread that it's time to wake up
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void acknowledgeEvent() {
|
||||
synchronized (sEventAckLock) {
|
||||
sWaitingForEventAck = false;
|
||||
@ -472,7 +472,7 @@ public class GeckoAppShell
|
||||
return lastKnownLocation;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableLocation(final boolean enable) {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -528,12 +528,12 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableLocationHighAccuracy(final boolean enable) {
|
||||
mLocationHighAccuracy = enable;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableSensor(int aSensortype) {
|
||||
GeckoInterface gi = getGeckoInterface();
|
||||
if (gi == null)
|
||||
@ -588,7 +588,7 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void disableSensor(int aSensortype) {
|
||||
GeckoInterface gi = getGeckoInterface();
|
||||
if (gi == null)
|
||||
@ -632,7 +632,7 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void moveTaskToBack() {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().getActivity().moveTaskToBack(true);
|
||||
@ -643,7 +643,7 @@ public class GeckoAppShell
|
||||
// Native Fennec doesn't care because the Java code already knows the selection indexes.
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "NotifyXreExit")
|
||||
@WrapElementForJNI(stubName = "NotifyXreExit")
|
||||
static void onXreExit() {
|
||||
// The launch state can only be Launched or GeckoRunning at this point
|
||||
GeckoThread.setLaunchState(GeckoThread.LaunchState.GeckoExiting);
|
||||
@ -659,7 +659,7 @@ public class GeckoAppShell
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
static void scheduleRestart() {
|
||||
gRestartScheduled = true;
|
||||
}
|
||||
@ -702,7 +702,7 @@ public class GeckoAppShell
|
||||
|
||||
// "Installs" an application by creating a shortcut
|
||||
// This is the entry point from AndroidBridge.h
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
static void createShortcut(String aTitle, String aURI, String aIconData, String aType) {
|
||||
if ("webapp".equals(aType)) {
|
||||
Log.w(LOGTAG, "createShortcut with no unique URI should not be used for aType = webapp!");
|
||||
@ -897,7 +897,7 @@ public class GeckoAppShell
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetHandlersForMimeTypeWrapper")
|
||||
@WrapElementForJNI(stubName = "GetHandlersForMimeTypeWrapper")
|
||||
static String[] getHandlersForMimeType(String aMimeType, String aAction) {
|
||||
Intent intent = getIntentForActionString(aAction);
|
||||
if (aMimeType != null && aMimeType.length() > 0)
|
||||
@ -905,7 +905,7 @@ public class GeckoAppShell
|
||||
return getHandlersForIntent(intent);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetHandlersForURLWrapper")
|
||||
@WrapElementForJNI(stubName = "GetHandlersForURLWrapper")
|
||||
static String[] getHandlersForURL(String aURL, String aAction) {
|
||||
// aURL may contain the whole URL or just the protocol
|
||||
Uri uri = aURL.indexOf(':') >= 0 ? Uri.parse(aURL) : new Uri.Builder().scheme(aURL).build();
|
||||
@ -948,12 +948,12 @@ public class GeckoAppShell
|
||||
return new Intent(aAction);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetExtensionFromMimeTypeWrapper")
|
||||
@WrapElementForJNI(stubName = "GetExtensionFromMimeTypeWrapper")
|
||||
static String getExtensionFromMimeType(String aMimeType) {
|
||||
return MimeTypeMap.getSingleton().getExtensionFromMimeType(aMimeType);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetMimeTypeFromExtensionsWrapper")
|
||||
@WrapElementForJNI(stubName = "GetMimeTypeFromExtensionsWrapper")
|
||||
static String getMimeTypeFromExtensions(String aFileExt) {
|
||||
StringTokenizer st = new StringTokenizer(aFileExt, ".,; ");
|
||||
String type = null;
|
||||
@ -1086,7 +1086,7 @@ public class GeckoAppShell
|
||||
* @param title the title to use in <code>ACTION_SEND</code> intents.
|
||||
* @return true if the activity started successfully; false otherwise.
|
||||
*/
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean openUriExternal(String targetURI,
|
||||
String mimeType,
|
||||
@OptionalGeneratedParameter String packageName,
|
||||
@ -1272,7 +1272,7 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "ShowAlertNotificationWrapper")
|
||||
@WrapElementForJNI(stubName = "ShowAlertNotificationWrapper")
|
||||
public static void showAlertNotification(String aImageUrl, String aAlertTitle, String aAlertText,
|
||||
String aAlertCookie, String aAlertName) {
|
||||
// The intent to launch when the user clicks the expanded notification
|
||||
@ -1299,13 +1299,13 @@ public class GeckoAppShell
|
||||
sNotificationClient.add(notificationID, aImageUrl, aAlertTitle, aAlertText, contentIntent);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void alertsProgressListener_OnProgress(String aAlertName, long aProgress, long aProgressMax, String aAlertText) {
|
||||
int notificationID = aAlertName.hashCode();
|
||||
sNotificationClient.update(notificationID, aProgress, aProgressMax, aAlertText);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void closeNotification(String aAlertName) {
|
||||
String alertCookie = mAlertCookies.get(aAlertName);
|
||||
if (alertCookie != null) {
|
||||
@ -1333,7 +1333,7 @@ public class GeckoAppShell
|
||||
closeNotification(aAlertName);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetDpiWrapper")
|
||||
@WrapElementForJNI(stubName = "GetDpiWrapper")
|
||||
public static int getDpi() {
|
||||
if (sDensityDpi == 0) {
|
||||
sDensityDpi = getContext().getResources().getDisplayMetrics().densityDpi;
|
||||
@ -1342,7 +1342,7 @@ public class GeckoAppShell
|
||||
return sDensityDpi;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget()
|
||||
@WrapElementForJNI
|
||||
public static float getDensity() {
|
||||
return getContext().getResources().getDisplayMetrics().density;
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ public class GeckoAppShell
|
||||
* Returns the colour depth of the default screen. This will either be
|
||||
* 24 or 16.
|
||||
*/
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetScreenDepthWrapper")
|
||||
@WrapElementForJNI(stubName = "GetScreenDepthWrapper")
|
||||
public static synchronized int getScreenDepth() {
|
||||
if (sScreenDepth == 0) {
|
||||
sScreenDepth = 16;
|
||||
@ -1400,27 +1400,27 @@ public class GeckoAppShell
|
||||
sScreenDepth = aScreenDepth;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void setFullScreen(boolean fullscreen) {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().setFullScreen(fullscreen);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "ShowFilePickerForExtensionsWrapper")
|
||||
@WrapElementForJNI(stubName = "ShowFilePickerForExtensionsWrapper")
|
||||
public static String showFilePickerForExtensions(String aExtensions) {
|
||||
if (getGeckoInterface() != null)
|
||||
return sActivityHelper.showFilePicker(getGeckoInterface().getActivity(), getMimeTypeFromExtensions(aExtensions));
|
||||
return "";
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "ShowFilePickerForMimeTypeWrapper")
|
||||
@WrapElementForJNI(stubName = "ShowFilePickerForMimeTypeWrapper")
|
||||
public static String showFilePickerForMimeType(String aMimeType) {
|
||||
if (getGeckoInterface() != null)
|
||||
return sActivityHelper.showFilePicker(getGeckoInterface().getActivity(), aMimeType);
|
||||
return "";
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void performHapticFeedback(boolean aIsLongPress) {
|
||||
// Don't perform haptic feedback if a vibration is currently playing,
|
||||
// because the haptic feedback will nuke the vibration.
|
||||
@ -1437,14 +1437,14 @@ public class GeckoAppShell
|
||||
return (Vibrator) layerView.getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "Vibrate1")
|
||||
@WrapElementForJNI(stubName = "Vibrate1")
|
||||
public static void vibrate(long milliseconds) {
|
||||
sVibrationEndTime = System.nanoTime() + milliseconds * 1000000;
|
||||
sVibrationMaybePlaying = true;
|
||||
vibrator().vibrate(milliseconds);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "VibrateA")
|
||||
@WrapElementForJNI(stubName = "VibrateA")
|
||||
public static void vibrate(long[] pattern, int repeat) {
|
||||
// If pattern.length is even, the last element in the pattern is a
|
||||
// meaningless delay, so don't include it in vibrationDuration.
|
||||
@ -1459,21 +1459,21 @@ public class GeckoAppShell
|
||||
vibrator().vibrate(pattern, repeat);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void cancelVibrate() {
|
||||
sVibrationMaybePlaying = false;
|
||||
sVibrationEndTime = 0;
|
||||
vibrator().cancel();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void showInputMethodPicker() {
|
||||
InputMethodManager imm = (InputMethodManager)
|
||||
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.showInputMethodPicker();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void setKeepScreenOn(final boolean on) {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -1483,7 +1483,7 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void notifyDefaultPrevented(final boolean defaultPrevented) {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -1497,7 +1497,7 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean isNetworkLinkUp() {
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
@ -1507,7 +1507,7 @@ public class GeckoAppShell
|
||||
return true;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean isNetworkLinkKnown() {
|
||||
ConnectivityManager cm = (ConnectivityManager)
|
||||
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
@ -1516,7 +1516,7 @@ public class GeckoAppShell
|
||||
return true;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void setSelectedLocale(String localeCode) {
|
||||
/* Bug 713464: This method is still called from Gecko side.
|
||||
Earlier we had an option to run Firefox in a language other than system's language.
|
||||
@ -1549,7 +1549,7 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetSystemColoursWrapper")
|
||||
@WrapElementForJNI(stubName = "GetSystemColoursWrapper")
|
||||
public static int[] getSystemColors() {
|
||||
// attrsAppearance[] must correspond to AndroidSystemColors structure in android/AndroidBridge.h
|
||||
final int[] attrsAppearance = {
|
||||
@ -1586,7 +1586,7 @@ public class GeckoAppShell
|
||||
return result;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void killAnyZombies() {
|
||||
GeckoProcessesVisitor visitor = new GeckoProcessesVisitor() {
|
||||
@Override
|
||||
@ -1742,7 +1742,7 @@ public class GeckoAppShell
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void scanMedia(String aFile, String aMimeType) {
|
||||
// If the platform didn't give us a mimetype, try to guess one from the filename
|
||||
if (TextUtils.isEmpty(aMimeType)) {
|
||||
@ -1756,7 +1756,7 @@ public class GeckoAppShell
|
||||
GeckoMediaScannerClient.startScan(context, aFile, aMimeType);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetIconForExtensionWrapper")
|
||||
@WrapElementForJNI(stubName = "GetIconForExtensionWrapper")
|
||||
public static byte[] getIconForExtension(String aExt, int iconSize) {
|
||||
try {
|
||||
if (iconSize <= 0)
|
||||
@ -1814,7 +1814,7 @@ public class GeckoAppShell
|
||||
return activityInfo.loadIcon(pm);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean getShowPasswordSetting() {
|
||||
try {
|
||||
int showPassword =
|
||||
@ -1827,7 +1827,7 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "AddPluginViewWrapper")
|
||||
@WrapElementForJNI(stubName = "AddPluginViewWrapper")
|
||||
public static void addPluginView(View view,
|
||||
float x, float y,
|
||||
float w, float h,
|
||||
@ -1836,7 +1836,7 @@ public class GeckoAppShell
|
||||
getGeckoInterface().addPluginView(view, new RectF(x, y, x + w, y + h), isFullScreen);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void removePluginView(View view, boolean isFullScreen) {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().removePluginView(view, isFullScreen);
|
||||
@ -2060,7 +2060,7 @@ public class GeckoAppShell
|
||||
|
||||
private static ContextGetter sContextGetter;
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true)
|
||||
@WrapElementForJNI(allowMultithread = true)
|
||||
public static Context getContext() {
|
||||
return sContextGetter.getContext();
|
||||
}
|
||||
@ -2118,7 +2118,7 @@ public class GeckoAppShell
|
||||
static byte[] sCameraBuffer = null;
|
||||
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "InitCameraWrapper")
|
||||
@WrapElementForJNI(stubName = "InitCameraWrapper")
|
||||
static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -2219,7 +2219,7 @@ public class GeckoAppShell
|
||||
return result;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
static synchronized void closeCamera() {
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -2271,32 +2271,32 @@ public class GeckoAppShell
|
||||
/*
|
||||
* Battery API related methods.
|
||||
*/
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableBatteryNotifications() {
|
||||
GeckoBatteryManager.enableNotifications();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "HandleGeckoMessageWrapper")
|
||||
@WrapElementForJNI(stubName = "HandleGeckoMessageWrapper")
|
||||
public static String handleGeckoMessage(String message) {
|
||||
return sEventDispatcher.dispatchEvent(message);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void disableBatteryNotifications() {
|
||||
GeckoBatteryManager.disableNotifications();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetCurrentBatteryInformationWrapper")
|
||||
@WrapElementForJNI(stubName = "GetCurrentBatteryInformationWrapper")
|
||||
public static double[] getCurrentBatteryInformation() {
|
||||
return GeckoBatteryManager.getCurrentInformation();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "CheckURIVisited")
|
||||
@WrapElementForJNI(stubName = "CheckURIVisited")
|
||||
static void checkUriVisited(String uri) {
|
||||
GlobalHistory.getInstance().checkUriVisited(uri);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "MarkURIVisited")
|
||||
@WrapElementForJNI(stubName = "MarkURIVisited")
|
||||
static void markUriVisited(final String uri) {
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
@ -2306,7 +2306,7 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "SetURITitle")
|
||||
@WrapElementForJNI(stubName = "SetURITitle")
|
||||
static void setUriTitle(final String uri, final String title) {
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
@ -2316,7 +2316,7 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
static void hideProgressDialog() {
|
||||
// unused stub
|
||||
}
|
||||
@ -2324,7 +2324,7 @@ public class GeckoAppShell
|
||||
/*
|
||||
* WebSMS related methods.
|
||||
*/
|
||||
@GeneratableAndroidBridgeTarget(stubName = "SendMessageWrapper")
|
||||
@WrapElementForJNI(stubName = "SendMessageWrapper")
|
||||
public static void sendMessage(String aNumber, String aMessage, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2333,7 +2333,7 @@ public class GeckoAppShell
|
||||
SmsManager.getInstance().send(aNumber, aMessage, aRequestId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetMessageWrapper")
|
||||
@WrapElementForJNI(stubName = "GetMessageWrapper")
|
||||
public static void getMessage(int aMessageId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2342,7 +2342,7 @@ public class GeckoAppShell
|
||||
SmsManager.getInstance().getMessage(aMessageId, aRequestId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "DeleteMessageWrapper")
|
||||
@WrapElementForJNI(stubName = "DeleteMessageWrapper")
|
||||
public static void deleteMessage(int aMessageId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2351,7 +2351,7 @@ public class GeckoAppShell
|
||||
SmsManager.getInstance().deleteMessage(aMessageId, aRequestId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "CreateMessageListWrapper")
|
||||
@WrapElementForJNI(stubName = "CreateMessageListWrapper")
|
||||
public static void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, int aDeliveryState, boolean aReverse, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2360,7 +2360,7 @@ public class GeckoAppShell
|
||||
SmsManager.getInstance().createMessageList(aStartDate, aEndDate, aNumbers, aNumbersCount, aDeliveryState, aReverse, aRequestId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetNextMessageInListWrapper")
|
||||
@WrapElementForJNI(stubName = "GetNextMessageInListWrapper")
|
||||
public static void getNextMessageInList(int aListId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2369,7 +2369,7 @@ public class GeckoAppShell
|
||||
SmsManager.getInstance().getNextMessageInList(aListId, aRequestId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void clearMessageList(int aListId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
return;
|
||||
@ -2379,7 +2379,7 @@ public class GeckoAppShell
|
||||
}
|
||||
|
||||
/* Called by JNI from AndroidBridge, and by reflection from tests/BaseTest.java.in */
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean isTablet() {
|
||||
return HardwareUtils.isTablet();
|
||||
}
|
||||
@ -2392,17 +2392,17 @@ public class GeckoAppShell
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetCurrentNetworkInformationWrapper")
|
||||
@WrapElementForJNI(stubName = "GetCurrentNetworkInformationWrapper")
|
||||
public static double[] getCurrentNetworkInformation() {
|
||||
return GeckoNetworkManager.getInstance().getCurrentInformation();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableNetworkNotifications() {
|
||||
GeckoNetworkManager.getInstance().enableNotifications();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void disableNetworkNotifications() {
|
||||
GeckoNetworkManager.getInstance().disableNotifications();
|
||||
}
|
||||
@ -2516,32 +2516,32 @@ public class GeckoAppShell
|
||||
return decodeBase64(s.getBytes(), flags);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetScreenOrientationWrapper")
|
||||
@WrapElementForJNI(stubName = "GetScreenOrientationWrapper")
|
||||
public static short getScreenOrientation() {
|
||||
return GeckoScreenOrientationListener.getInstance().getScreenOrientation();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void enableScreenOrientationNotifications() {
|
||||
GeckoScreenOrientationListener.getInstance().enableNotifications();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void disableScreenOrientationNotifications() {
|
||||
GeckoScreenOrientationListener.getInstance().disableNotifications();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void lockScreenOrientation(int aOrientation) {
|
||||
GeckoScreenOrientationListener.getInstance().lockScreenOrientation(aOrientation);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void unlockScreenOrientation() {
|
||||
GeckoScreenOrientationListener.getInstance().unlockScreenOrientation();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean pumpMessageLoop() {
|
||||
Handler geckoHandler = ThreadUtils.sGeckoHandler;
|
||||
Message msg = getNextMessageFromQueue(ThreadUtils.sGeckoQueue);
|
||||
@ -2563,7 +2563,7 @@ public class GeckoAppShell
|
||||
|
||||
static native void notifyFilePickerResult(String filePath, long id);
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "ShowFilePickerAsyncWrapper")
|
||||
@WrapElementForJNI(stubName = "ShowFilePickerAsyncWrapper")
|
||||
public static void showFilePickerAsync(String aMimeType, final long id) {
|
||||
sActivityHelper.showFilePickerAsync(getGeckoInterface().getActivity(), aMimeType, new ActivityHandlerHelper.FileResultHandler() {
|
||||
public void gotFile(String filename) {
|
||||
@ -2572,18 +2572,18 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void notifyWakeLockChanged(String topic, String state) {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().notifyWakeLockChanged(topic, state);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetGfxInfoDataWrapper")
|
||||
@WrapElementForJNI(stubName = "GetGfxInfoDataWrapper")
|
||||
public static String getGfxInfoData() {
|
||||
return GfxInfoThread.getData();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static void registerSurfaceTextureFrameListener(Object surfaceTexture, final int id) {
|
||||
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(new SurfaceTexture.OnFrameAvailableListener() {
|
||||
@Override
|
||||
@ -2593,12 +2593,12 @@ public class GeckoAppShell
|
||||
});
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true)
|
||||
@WrapElementForJNI(allowMultithread = true)
|
||||
public static void unregisterSurfaceTextureFrameListener(Object surfaceTexture) {
|
||||
((SurfaceTexture)surfaceTexture).setOnFrameAvailableListener(null);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget
|
||||
@WrapElementForJNI
|
||||
public static boolean unlockProfile() {
|
||||
// Try to kill any zombie Fennec's that might be running
|
||||
GeckoAppShell.killAnyZombies();
|
||||
@ -2612,7 +2612,7 @@ public class GeckoAppShell
|
||||
return false;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetProxyForURIWrapper")
|
||||
@WrapElementForJNI(stubName = "GetProxyForURIWrapper")
|
||||
public static String getProxyForURI(String spec, String scheme, String host, int port) {
|
||||
URI uri = null;
|
||||
try {
|
||||
|
@ -8,7 +8,7 @@ package org.mozilla.gecko;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
|
||||
import java.lang.Thread;
|
||||
import java.util.HashMap;
|
||||
@ -126,7 +126,7 @@ public class GeckoJavaSampler {
|
||||
}
|
||||
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "GetThreadNameJavaProfilingWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "GetThreadNameJavaProfilingWrapper")
|
||||
public synchronized static String getThreadName(int aThreadId) {
|
||||
if (aThreadId == 0 && sMainThread != null) {
|
||||
return sMainThread.getName();
|
||||
@ -138,7 +138,7 @@ public class GeckoJavaSampler {
|
||||
return sSamplingRunnable.getSample(aThreadId, aSampleId);
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "GetSampleTimeJavaProfiling")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "GetSampleTimeJavaProfiling")
|
||||
public synchronized static double getSampleTime(int aThreadId, int aSampleId) {
|
||||
Sample sample = getSample(aThreadId, aSampleId);
|
||||
if (sample != null) {
|
||||
@ -152,7 +152,7 @@ public class GeckoJavaSampler {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "GetFrameNameJavaProfilingWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "GetFrameNameJavaProfilingWrapper")
|
||||
public synchronized static String getFrameName(int aThreadId, int aSampleId, int aFrameId) {
|
||||
Sample sample = getSample(aThreadId, aSampleId);
|
||||
if (sample != null && aFrameId < sample.mFrames.length) {
|
||||
@ -165,7 +165,7 @@ public class GeckoJavaSampler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "StartJavaProfiling")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "StartJavaProfiling")
|
||||
public static void start(int aInterval, int aSamples) {
|
||||
synchronized (GeckoJavaSampler.class) {
|
||||
if (sSamplingRunnable != null) {
|
||||
@ -177,21 +177,21 @@ public class GeckoJavaSampler {
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "PauseJavaProfiling")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "PauseJavaProfiling")
|
||||
public static void pause() {
|
||||
synchronized (GeckoJavaSampler.class) {
|
||||
sSamplingRunnable.mPauseSampler = true;
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "UnpauseJavaProfiling")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "UnpauseJavaProfiling")
|
||||
public static void unpause() {
|
||||
synchronized (GeckoJavaSampler.class) {
|
||||
sSamplingRunnable.mPauseSampler = false;
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "StopJavaProfiling")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "StopJavaProfiling")
|
||||
public static void stop() {
|
||||
synchronized (GeckoJavaSampler.class) {
|
||||
if (sSamplingThread == null) {
|
||||
|
@ -9,10 +9,12 @@ include $(topsrcdir)/mobile/android/base/android-services-files.mk
|
||||
MOZGLUE_JAVA_FILES := \
|
||||
mozglue/ByteBufferInputStream.java \
|
||||
mozglue/DirectBufferAllocator.java \
|
||||
mozglue/GeneratableAndroidBridgeTarget.java \
|
||||
mozglue/generatorannotations/GeneratorOptions.java \
|
||||
mozglue/generatorannotations/OptionalGeneratedParameter.java \
|
||||
mozglue/generatorannotations/WrapEntireClassForJNI.java \
|
||||
mozglue/generatorannotations/WrapElementForJNI.java \
|
||||
mozglue/NativeReference.java \
|
||||
mozglue/NativeZip.java \
|
||||
mozglue/OptionalGeneratedParameter.java \
|
||||
$(NULL)
|
||||
|
||||
MOZGLUE_PP_JAVA_FILES := \
|
||||
|
@ -9,7 +9,7 @@ import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.IntSize;
|
||||
import org.mozilla.gecko.mozglue.DirectBufferAllocator;
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
@ -144,7 +144,7 @@ public final class ThumbnailHelper {
|
||||
}
|
||||
|
||||
/* This method is invoked by JNI once the thumbnail data is ready. */
|
||||
@GeneratableAndroidBridgeTarget(stubName = "SendThumbnail")
|
||||
@WrapElementForJNI(stubName = "SendThumbnail")
|
||||
public static void notifyThumbnail(ByteBuffer data, int tabId, boolean success) {
|
||||
Tab tab = Tabs.getInstance().getTab(tabId);
|
||||
ThumbnailHelper helper = ThumbnailHelper.getInstance();
|
||||
|
@ -8,7 +8,7 @@ package org.mozilla.gecko.gfx;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.util.Log;
|
||||
@ -263,7 +263,7 @@ public class GLController {
|
||||
throw new GLControllerException("No suitable EGL configuration found");
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "ProvideEGLSurfaceWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "ProvideEGLSurfaceWrapper")
|
||||
private EGLSurface provideEGLSurface() {
|
||||
return mEGLSurface;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import org.mozilla.gecko.PrefsHelper;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.TouchEventInterceptor;
|
||||
import org.mozilla.gecko.ZoomConstraints;
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
import org.mozilla.gecko.util.EventDispatcher;
|
||||
|
||||
import android.content.Context;
|
||||
@ -527,7 +527,7 @@ public class LayerView extends FrameLayout {
|
||||
return mTextureView.getSurfaceTexture();
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "RegisterCompositorWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "RegisterCompositorWrapper")
|
||||
public static GLController registerCxxCompositor() {
|
||||
try {
|
||||
LayerView layerView = GeckoAppShell.getLayerView();
|
||||
|
@ -7,7 +7,7 @@ package org.mozilla.gecko.gfx;
|
||||
|
||||
import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
import org.mozilla.gecko.util.EventDispatcher;
|
||||
import org.mozilla.gecko.util.GeckoEventListener;
|
||||
|
||||
@ -83,12 +83,12 @@ class NativePanZoomController implements PanZoomController, GeckoEventListener {
|
||||
public native void setOverScrollMode(int overscrollMode);
|
||||
public native int getOverScrollMode();
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "RequestContentRepaintWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "RequestContentRepaintWrapper")
|
||||
private void requestContentRepaint(float x, float y, float width, float height, float resolution) {
|
||||
mTarget.forceRedraw(new DisplayPortMetrics(x, y, x + width, y + height, resolution));
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(allowMultithread = true, stubName = "PostDelayedCallbackWrapper")
|
||||
@WrapElementForJNI(allowMultithread = true, stubName = "PostDelayedCallbackWrapper")
|
||||
private void postDelayedCallback(long delay) {
|
||||
mTarget.postDelayed(mCallbackRunnable, delay);
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.mozglue.generatorannotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface GeneratorOptions {
|
||||
// Specifies a custom name for the generated C++ class. If left empty, is AndroidJavaClassName.
|
||||
String generatedClassName() default "";
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.mozglue;
|
||||
package org.mozilla.gecko.mozglue.generatorannotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.mozglue;
|
||||
package org.mozilla.gecko.mozglue.generatorannotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* and may lead to subtle bugs.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface GeneratableAndroidBridgeTarget {
|
||||
public @interface WrapElementForJNI {
|
||||
// Optional parameter specifying the name of the generated method stub. If omitted, the name
|
||||
// of the Java method will be used.
|
||||
String stubName() default "";
|
@ -0,0 +1,15 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.mozglue.generatorannotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Handy shortcut annotation. Functionally equivalent to tagging every member individually with default
|
||||
* settings.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface WrapEntireClassForJNI {}
|
@ -9,7 +9,7 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import org.mozilla.gecko.mozglue.GeneratableAndroidBridgeTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
|
||||
@ -29,7 +29,7 @@ public final class Clipboard {
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "GetClipboardTextWrapper")
|
||||
@WrapElementForJNI(stubName = "GetClipboardTextWrapper")
|
||||
public static String getText() {
|
||||
// If we're on the UI thread or the background thread, we have a looper on the thread
|
||||
// and can just call this directly. For any other threads, post the call to the
|
||||
@ -55,7 +55,7 @@ public final class Clipboard {
|
||||
}
|
||||
}
|
||||
|
||||
@GeneratableAndroidBridgeTarget(stubName = "SetClipboardText")
|
||||
@WrapElementForJNI(stubName = "SetClipboardText")
|
||||
public static void setText(final CharSequence text) {
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user