Skip to content

Commit

Permalink
Merge pull request #643 from rokwire/release/v2.10.25+1025
Browse files Browse the repository at this point in the history
Release/v2.10.25+1025
  • Loading branch information
sandeep-ps authored May 18, 2021
2 parents d7676d9 + 8e5f1c9 commit c7f4ada
Show file tree
Hide file tree
Showing 18 changed files with 1,223 additions and 89 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [2.10.25] - 2021-05-14
- Add the External link icon to External links [#635](https://github.com/rokwire/safer-illinois-app/issues/635).
- Android: Fix for frequent notifications [#641](https://github.com/rokwire/safer-illinois-app/issues/641).

## [2.10.23] - 2021-05-07
- Changed DefaultTestMonitorInterval to reflect production [#624](https://github.com/rokwire/safer-illinois-app/issues/624).
- Removed test result explanation disclaimers [#626](https://github.com/rokwire/safer-illinois-app/issues/626)
- Android: Fix crash in exposures - removeExpiredTime [#629](https://github.com/rokwire/safer-illinois-app/issues/629).
- Added Japanese language translation provided by @kamya-k
- Android: Fix crash in exposures - processExposures [#631](https://github.com/rokwire/safer-illinois-app/issues/631).
- Android: Fix crash in exposures - onReceive [#633](https://github.com/rokwire/safer-illinois-app/issues/633).

## [2.10.22] - 2021-04-27
### Fixed
- Fixed app misbehavior when system date time is much behind the current date time [#615](https://github.com/rokwire/safer-illinois-app/issues/615).
Expand Down Expand Up @@ -667,4 +679,4 @@ Build number 1019 was taken by 2.9.22 release
## [2.3.4] - 2020-08-19
### Added
- Latest content from the private repository.
- GitHub Issue templates.
- GitHub Issue templates.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@
import edu.illinois.covid.exposure.crypto.AES_CTR;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.EventChannel;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry;

public class ExposurePlugin implements MethodChannel.MethodCallHandler, FlutterPlugin {

Expand Down Expand Up @@ -517,7 +515,9 @@ private void processExposures() {
}

if ((expiredPeripheralAddress != null) && !expiredPeripheralAddress.isEmpty()) {
for (String address : expiredPeripheralAddress) {
// Create copy so that to prevent crash with ConcurrentModificationException.
Set<String> expiredPeripheralAddressCopy = new HashSet<>(expiredPeripheralAddress);
for (String address : expiredPeripheralAddressCopy) {
// remove expired records from iosExposures
disconnectIosPeripheral(address);
}
Expand All @@ -542,8 +542,10 @@ private void processExposures() {
}

if (expiredRPIs != null) {
// Create copy so that to prevent crash with ConcurrentModificationException.
Set<String> expiredRPIsCopy = new HashSet<>(expiredRPIs);
// remove expired records from androidExposures
for (String encodedRpi : expiredRPIs) {
for (String encodedRpi : expiredRPIsCopy) {
removeAndroidRpi(encodedRpi);
}
}
Expand Down Expand Up @@ -1243,9 +1245,11 @@ private void removeExpiredTime() {
if (expUpTimeMap != null) {
long currentTime = (long) Utils.DateTime.getCurrentTimeMillisSince1970() / 1000;
long _expireTimestamp = currentTime - 168 * 60 * 60;
for (Integer _time : expUpTimeMap.keySet()) {
if ((_time.intValue() + expUpTimeMap.get(_time).intValue()) < (int)_expireTimestamp) {
expUpTimeMap.remove(_time);
Iterator<Integer> it = expUpTimeMap.keySet().iterator();
while (it.hasNext()) {
Integer _time = it.next();
if ((_time.intValue() + expUpTimeMap.get(_time).intValue()) < (int) _expireTimestamp) {
it.remove();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public ExposureClient getService() {
}
private final IBinder mBinder = new LocalBinder();

private static ExposureClient instance;

private BluetoothAdapter mBluetoothAdapter;

private PreOreoScanner preOreoScanner;
Expand All @@ -71,6 +73,10 @@ public ExposureClient getService() {

private Object settings;

public static ExposureClient getInstance() {
return instance;
}

@Override
public IBinder onBind(Intent intent) {
return mBinder;
Expand All @@ -91,6 +97,7 @@ public void onCreate() {
preOreoScanner = new PreOreoScanner(mBluetoothAdapter);
}
startForegroundClientService();
instance = this;
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
registerReceiver(bluetoothReceiver, filter);
}
Expand Down Expand Up @@ -124,8 +131,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {

@Override
public void onDestroy() {
stopForeground(true);
stopSelf();
stopService();
unregisterReceiver(bluetoothReceiver);
}

Expand Down Expand Up @@ -170,6 +176,10 @@ public void onDevice(ScanResult result) {
}
}

public boolean exposureServiceLocalNotificationEnabled() {
return Utils.Map.getValueFromPath(settings, "covid19ExposureServiceLocalNotificationEnabledAndroid", false);
}

private boolean needsWaitBluetooth() {
if ((mBluetoothAdapter == null) || !mBluetoothAdapter.isEnabled()) {
Log.d(TAG, "processBluetoothCheck needs to wait for bluetooth");
Expand Down Expand Up @@ -204,8 +214,7 @@ public void stopScan() {
waitBluetoothOn.set(false);
waitLocationPermissionGranted.set(false);

stopForeground(true);
stopSelf();
stopService();
isScanning.set(false);
}

Expand Down Expand Up @@ -257,6 +266,11 @@ private void onScanResultFound(ScanResult scanResult) {
}
}

private void stopService() {
stopForeground(true);
stopSelf();
}

//region BroadcastReceiver

private final BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
Expand Down Expand Up @@ -304,7 +318,7 @@ private void createNotificationChannelIfNeeded() {
}

private void startForegroundClientService() {
boolean exposureServiceLocalNotificationEnabled = Utils.Map.getValueFromPath(settings, "covid19ExposureServiceLocalNotificationEnabledAndroid", false);
boolean exposureServiceLocalNotificationEnabled = exposureServiceLocalNotificationEnabled();
if (exposureServiceLocalNotificationEnabled) {
createNotificationChannelIfNeeded();
startForeground(NotificationCreator.getOngoingNotificationId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package edu.illinois.covid.exposure.ble.scan;

import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.bluetooth.le.ScanResult;
import android.content.BroadcastReceiver;
import android.content.Context;
Expand All @@ -27,7 +26,6 @@
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import edu.illinois.covid.Constants;
import edu.illinois.covid.exposure.ble.ExposureClient;
Expand All @@ -51,8 +49,13 @@ public void onReceive(Context context, Intent intent) {
}
Intent bleClientIntent = new Intent(context, ExposureClient.class);
bleClientIntent.putExtra(Constants.EXPOSURE_BLE_DEVICE_FOUND, scanResult);
boolean exposureClientRunning = isExposureClientServiceRunning(context);
if (exposureClientRunning) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Check if local notifications are enabled for Android. We can start foreground service only if they are enabled. Required for API >= 26
boolean canStartClientService = (ExposureClient.getInstance() != null) && ExposureClient.getInstance().exposureServiceLocalNotificationEnabled();
if (canStartClientService) {
context.startForegroundService(bleClientIntent);
}
} else {
context.startService(bleClientIntent);
}
}
Expand Down Expand Up @@ -81,19 +84,4 @@ private ScanResult extractData(Bundle extras) {
}
return null;
}

private boolean isExposureClientServiceRunning(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (manager != null) {
List<ActivityManager.RunningServiceInfo> runningServices = manager.getRunningServices(Integer.MAX_VALUE);
if ((runningServices != null) && !runningServices.isEmpty()) {
for (ActivityManager.RunningServiceInfo service : runningServices) {
if (ExposureClient.class.getName().equals(service.service.getClassName())) {
return true;
}
}
}
}
return false;
}
}
53 changes: 53 additions & 0 deletions android/app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2020 Board of Trustees of the University of Illinois.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<resources>
<string name="app_name">Safer Illinois</string>

<string name="today">今日</string>
<string name="tomorrow">明日</string>
<string name="at">で</string>

<string name="explores">探索する</string>
<string name="events">イベント</string>
<string name="dinings">ダイニングオプション</string>
<string name="places">場所</string>
<string name="laundries">ランドリー</string>
<string name="parkings">駐車場</string>
<string name="ok">OK</string>

<!-- MapDirectionsActivity -->
<string name="directionsTitle">行き方</string>
<string name="routeFailedMsg">ルートが見つかりませんでした。</string>
<string name="locationFailedMsg">現在地の検出に失敗しました。</string>
<string name="start">開始</string>
<string name="finish">仕上げ</string>
<string name="routeDistanceDurationFormat">%1$d 分 | %2$d 秒</string>
<string name="routeLegStepFormat">脚 %1$d / ステップ %2$d</string>
<string name="mile">マイル</string>
<string name="miles">マイル</string>
<string name="minute">分</string>

<!-- MapActivity -->
<string name="mapTitle">マップ</string>

<!-- Exposure -->
<string name="exposure_notification_channel_description">接触通知システム</string>
<string name="exposure_notification_title">接触通知システムのチェック</string>
<string name="exposure_notification_ticker">接触通知システムのチェック</string>
<string name="exposure_request_bluetooth_on_message">接触通知を許可します。 Bluetoothをオンにしますか?</string>
</resources>
Loading

0 comments on commit c7f4ada

Please sign in to comment.