Merge branch '0.100-alpha8-fixes' into 'master'

0.100 alpha8 fixes

3 bug fixes for ACRA crash reports

See merge request !310
This commit is contained in:
Hans-Christoph Steiner 2016-05-25 00:31:45 +00:00
commit 082a2f5fef
3 changed files with 24 additions and 3 deletions

View File

@ -357,9 +357,18 @@ public class InstallManagerService extends Service {
TEMP_HACK_APP_NAMES.put(urlString, app.name); // TODO delete me once InstallerService exists
}
/**
* Remove the {@link App} and {@Apk} instances that are associated with
* {@code urlString} from the {@link Map} of active apps. This can be
* called after this service has been destroyed and recreated based on the
* {@link BroadcastReceiver}s, in which case {@code urlString} would not
* find anything in the active maps.
*/
private static Apk removeFromActive(String urlString) {
Apk apk = ACTIVE_APKS.remove(urlString);
ACTIVE_APPS.remove(apk.packageName);
if (apk != null) {
ACTIVE_APPS.remove(apk.packageName);
}
return apk;
}

View File

@ -36,6 +36,12 @@ import java.util.Locale;
* which is how it can be triggered by code, or it came in from the system
* via {@link org.fdroid.fdroid.receiver.WifiStateChangeReceiver}, in
* which case an instance of {@link NetworkInfo} is included.
*
* The work is done in a {@link Thread} so that new incoming {@code Intents}
* are not blocked by processing. A new {@code Intent} immediately nullifies
* the current state because it means that something about the wifi has
* changed. Having the {@code Thread} also makes it easy to kill work
* that is in progress.
*/
public class WifiStateChangeService extends IntentService {
private static final String TAG = "WifiStateChangeService";
@ -202,9 +208,15 @@ public class WifiStateChangeService extends IntentService {
}
// the following methods were not added until android-9/Gingerbread
for (InterfaceAddress address : netIf.getInterfaceAddresses()) {
short networkPrefixLength = address.getNetworkPrefixLength();
if (networkPrefixLength > 32) {
// something is giving a "/64" netmask, IPv6?
// java.lang.IllegalArgumentException: Value [64] not in range [0,32]
continue;
}
if (inetAddress.equals(address.getAddress()) && !TextUtils.isEmpty(FDroidApp.ipAddressString)) {
String cidr = String.format(Locale.ENGLISH, "%s/%d",
FDroidApp.ipAddressString, address.getNetworkPrefixLength());
FDroidApp.ipAddressString, networkPrefixLength);
FDroidApp.subnetInfo = new SubnetUtils(cidr).getInfo();
break;
}

View File

@ -34,7 +34,7 @@ public class BluetoothConnection {
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void open() throws IOException {
if (!socket.isConnected()) {
if (Build.VERSION.SDK_INT >= 14 && !socket.isConnected()) {
// Server sockets will already be connected when they are passed to us,
// client sockets require us to call connect().
socket.connect();