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 163218 e512dcbdb0d9f4fb2a285faf97dec8a96073fd20
parent 163217 8dbd605bb313da2c76e08b4438e09fbdae406fbb
child 163219 c15cacb7efd6caaa6fd57313ed2d3746416630bf
child 163246 34dddf6f7ec1b05534483e8181a8e48278aa914b
push id4309
push userwjohnston@mozilla.com
push dateMon, 13 Jan 2014 23:21:35 +0000
treeherderfx-team@e512dcbdb0d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs921112
milestone29.0a1
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);
     }
 }