Bug 921112 - Prohibit proguad from erasing JNI MCC methods. r=bnicholson
authorWes Johnston <wjohnston@mozilla.com>
Mon, 13 Jan 2014 15:20:15 -0800
changeset 163239 e512dcbdb0d9f4fb2a285faf97dec8a96073fd20
parent 163238 8dbd605bb313da2c76e08b4438e09fbdae406fbb
child 163240 34dddf6f7ec1b05534483e8181a8e48278aa914b
child 163259 c15cacb7efd6caaa6fd57313ed2d3746416630bf
push id25987
push userkwierso@gmail.com
push dateTue, 14 Jan 2014 04:49:27 +0000
treeherdermozilla-central@34dddf6f7ec1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs921112
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 921112 - Prohibit proguad from erasing JNI MCC methods. r=bnicholson
mobile/android/base/GeckoNetworkManager.java
--- a/mobile/android/base/GeckoNetworkManager.java
+++ b/mobile/android/base/GeckoNetworkManager.java
@@ -1,15 +1,17 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * 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;
 
+import org.mozilla.gecko.mozglue.JNITarget;
+
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.ConnectivityManager;
 import android.net.DhcpInfo;
 import android.net.NetworkInfo;
 import android.net.wifi.WifiManager;
@@ -347,16 +349,19 @@ public class GeckoNetworkManager extends
             return Integer.parseInt(networkOperator.substring(3));
         } else if (type == InfoType.MCC) {
             return Integer.parseInt(networkOperator.substring(0, 3));
         }
 
         return -1;
     }
 
+    /* These are called from javascript c-types. Avoid letting pro-guard delete them */
+    @JNITarget
     public static int getMCC() {
         return getNetworkOperator(InfoType.MCC);
     }
 
+    @JNITarget
     public static int getMNC() {
         return getNetworkOperator(InfoType.MNC);
     }
 }