Loading core/java/android/net/NetworkAgent.java +10 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -296,7 +297,15 @@ public abstract class NetworkAgent extends Handler { } case CMD_SET_SIGNAL_STRENGTH_THRESHOLDS: { setSignalStrengthThresholds((int[]) msg.obj); ArrayList<Integer> thresholds = ((Bundle) msg.obj).getIntegerArrayList("thresholds"); // TODO: Change signal strength thresholds API to use an ArrayList<Integer> // rather than convert to int[]. int[] intThresholds = new int[(thresholds != null) ? thresholds.size() : 0]; for (int i = 0; i < intThresholds.length; i++) { intThresholds[i] = thresholds.get(i); } setSignalStrengthThresholds(intThresholds); break; } } Loading services/core/java/com/android/server/ConnectivityService.java +5 −12 Original line number Diff line number Diff line Loading @@ -3611,7 +3611,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } } private int[] getSignalStrengthThresholds(NetworkAgentInfo nai) { private ArrayList<Integer> getSignalStrengthThresholds(NetworkAgentInfo nai) { final SortedSet<Integer> thresholds = new TreeSet(); synchronized (nai) { for (NetworkRequestInfo nri : mNetworkRequests.values()) { Loading @@ -3621,22 +3621,15 @@ public class ConnectivityService extends IConnectivityManager.Stub } } } // We can't just do something like: // return thresholds.toArray(new int[thresholds.size()]); // because autoboxing does not work for primitive arrays. final int[] out = new int[thresholds.size()]; int pos = 0; for (Integer threshold : thresholds) { out[pos] = threshold; pos++; } return out; return new ArrayList<Integer>(thresholds); } private void updateSignalStrengthThresholds(NetworkAgentInfo nai) { Bundle thresholds = new Bundle(); thresholds.putIntegerArrayList("thresholds", getSignalStrengthThresholds(nai)); nai.asyncChannel.sendMessage( android.net.NetworkAgent.CMD_SET_SIGNAL_STRENGTH_THRESHOLDS, 0, 0, getSignalStrengthThresholds(nai)); 0, 0, thresholds); } @Override Loading Loading
core/java/android/net/NetworkAgent.java +10 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.os.Message; Loading Loading @@ -296,7 +297,15 @@ public abstract class NetworkAgent extends Handler { } case CMD_SET_SIGNAL_STRENGTH_THRESHOLDS: { setSignalStrengthThresholds((int[]) msg.obj); ArrayList<Integer> thresholds = ((Bundle) msg.obj).getIntegerArrayList("thresholds"); // TODO: Change signal strength thresholds API to use an ArrayList<Integer> // rather than convert to int[]. int[] intThresholds = new int[(thresholds != null) ? thresholds.size() : 0]; for (int i = 0; i < intThresholds.length; i++) { intThresholds[i] = thresholds.get(i); } setSignalStrengthThresholds(intThresholds); break; } } Loading
services/core/java/com/android/server/ConnectivityService.java +5 −12 Original line number Diff line number Diff line Loading @@ -3611,7 +3611,7 @@ public class ConnectivityService extends IConnectivityManager.Stub } } private int[] getSignalStrengthThresholds(NetworkAgentInfo nai) { private ArrayList<Integer> getSignalStrengthThresholds(NetworkAgentInfo nai) { final SortedSet<Integer> thresholds = new TreeSet(); synchronized (nai) { for (NetworkRequestInfo nri : mNetworkRequests.values()) { Loading @@ -3621,22 +3621,15 @@ public class ConnectivityService extends IConnectivityManager.Stub } } } // We can't just do something like: // return thresholds.toArray(new int[thresholds.size()]); // because autoboxing does not work for primitive arrays. final int[] out = new int[thresholds.size()]; int pos = 0; for (Integer threshold : thresholds) { out[pos] = threshold; pos++; } return out; return new ArrayList<Integer>(thresholds); } private void updateSignalStrengthThresholds(NetworkAgentInfo nai) { Bundle thresholds = new Bundle(); thresholds.putIntegerArrayList("thresholds", getSignalStrengthThresholds(nai)); nai.asyncChannel.sendMessage( android.net.NetworkAgent.CMD_SET_SIGNAL_STRENGTH_THRESHOLDS, 0, 0, getSignalStrengthThresholds(nai)); 0, 0, thresholds); } @Override Loading