mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-09 03:37:03 +01:00
Bump targetSdkVersion to 34
This commit is contained in:
parent
c31f4ce89f
commit
fad092b6f8
@ -74,8 +74,8 @@ android {
|
|||||||
applicationId "nodomain.freeyourgadget.gadgetbridge"
|
applicationId "nodomain.freeyourgadget.gadgetbridge"
|
||||||
|
|
||||||
//noinspection OldTargetApi
|
//noinspection OldTargetApi
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
compileSdk 33
|
compileSdk 34
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
|
|
||||||
// Note: always bump BOTH versionCode and versionName!
|
// Note: always bump BOTH versionCode and versionName!
|
||||||
@ -114,7 +114,7 @@ android {
|
|||||||
applicationIdSuffix ".banglejs"
|
applicationIdSuffix ".banglejs"
|
||||||
versionNameSuffix "-banglejs"
|
versionNameSuffix "-banglejs"
|
||||||
buildConfigField "boolean", "INTERNET_ACCESS", "true"
|
buildConfigField "boolean", "INTERNET_ACCESS", "true"
|
||||||
targetSdkVersion 33
|
targetSdkVersion 34
|
||||||
// Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions
|
// Note: app/src/banglejs/AndroidManifest.xml contains some extra permissions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@
|
|||||||
<!-- Used for background service -->
|
<!-- Used for background service -->
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND" />
|
<uses-permission android:name="android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND" />
|
||||||
|
|
||||||
<!-- Used for reverse find device -->
|
<!-- Used for reverse find device -->
|
||||||
@ -455,22 +457,35 @@
|
|||||||
android:name=".externalevents.NotificationListener"
|
android:name=".externalevents.NotificationListener"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
|
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
|
||||||
android:exported="false">
|
android:exported="false"
|
||||||
|
android:foregroundServiceType="specialUse">
|
||||||
|
<property
|
||||||
|
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||||
|
android:value="Bind to notification listener for capturing and forwarding notifications" />
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.service.notification.NotificationListenerService" />
|
<action android:name="android.service.notification.NotificationListenerService" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
<service android:name=".service.NotificationCollectorMonitorService" />
|
<service
|
||||||
<service android:name=".service.DeviceCommunicationService" />
|
android:name=".service.NotificationCollectorMonitorService"
|
||||||
|
android:foregroundServiceType="specialUse">
|
||||||
|
<property
|
||||||
|
android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
|
||||||
|
android:value="Service for capturing and forwarding notifications" />
|
||||||
|
</service>
|
||||||
|
<service
|
||||||
|
android:name=".service.DeviceCommunicationService"
|
||||||
|
android:foregroundServiceType="connectedDevice" />
|
||||||
<service
|
<service
|
||||||
android:name=".devices.pinetime.PineTimeDFUService"
|
android:name=".devices.pinetime.PineTimeDFUService"
|
||||||
android:label="PineTime Nordic DFU service" />
|
android:label="PineTime Nordic DFU service"
|
||||||
|
android:foregroundServiceType="connectedDevice" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.btle.BLEScanService"
|
android:name=".service.btle.BLEScanService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="false">
|
android:exported="false"
|
||||||
</service>
|
android:foregroundServiceType="connectedDevice" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".externalevents.GenericWeatherReceiver"
|
android:name=".externalevents.GenericWeatherReceiver"
|
||||||
|
@ -26,6 +26,7 @@ import android.view.MenuItem;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
@ -51,7 +52,6 @@ import nodomain.freeyourgadget.gadgetbridge.entities.Device;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
import nodomain.freeyourgadget.gadgetbridge.entities.User;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.entities.WorldClock;
|
import nodomain.freeyourgadget.gadgetbridge.entities.WorldClock;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ public class ConfigureWorldClocks extends AbstractGBActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
registerReceiver(timeTickBroadcastReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
|
ContextCompat.registerReceiver(this, timeTickBroadcastReceiver, new IntentFilter(Intent.ACTION_TIME_TICK), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,6 +71,7 @@ import androidx.core.app.ActivityCompat;
|
|||||||
import androidx.core.app.NavUtils;
|
import androidx.core.app.NavUtils;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.RemoteInput;
|
import androidx.core.app.RemoteInput;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ public class DebugActivity extends AbstractGBActivity {
|
|||||||
filter.addAction(ACTION_REPLY);
|
filter.addAction(ACTION_REPLY);
|
||||||
filter.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
|
filter.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
|
LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
|
||||||
registerReceiver(mReceiver, filter); // for ACTION_REPLY
|
ContextCompat.registerReceiver(this, mReceiver, filter, ContextCompat.RECEIVER_EXPORTED); // for ACTION_REPLY
|
||||||
|
|
||||||
editContent = findViewById(R.id.editContent);
|
editContent = findViewById(R.id.editContent);
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ public class HeartRateDialog extends Dialog {
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
|
filter.addAction(DeviceService.ACTION_REALTIME_SAMPLES);
|
||||||
LocalBroadcastManager.getInstance(getContext()).registerReceiver(mReceiver, filter);
|
LocalBroadcastManager.getInstance(getContext()).registerReceiver(mReceiver, filter);
|
||||||
getContext().registerReceiver(mReceiver, filter);
|
|
||||||
|
|
||||||
setContentView(R.layout.heart_rate_dialog);
|
setContentView(R.layout.heart_rate_dialog);
|
||||||
heart_rate_dialog_results_layout = findViewById(R.id.heart_rate_dialog_results_layout);
|
heart_rate_dialog_results_layout = findViewById(R.id.heart_rate_dialog_results_layout);
|
||||||
|
@ -63,6 +63,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.annotation.RequiresPermission;
|
import androidx.annotation.RequiresPermission;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||||
|
|
||||||
@ -785,7 +786,7 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
|
|||||||
bluetoothIntents.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
|
bluetoothIntents.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
|
||||||
bluetoothIntents.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
|
bluetoothIntents.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||||
|
|
||||||
registerReceiver(bluetoothReceiver, bluetoothIntents);
|
ContextCompat.registerReceiver(this, bluetoothReceiver, bluetoothIntents, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,9 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -33,8 +36,6 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
@ -120,7 +121,7 @@ public class DeviceManager {
|
|||||||
filterGlobal.addAction(BluetoothDevice.ACTION_NAME_CHANGED);
|
filterGlobal.addAction(BluetoothDevice.ACTION_NAME_CHANGED);
|
||||||
filterGlobal.addAction(BLUETOOTH_DEVICE_ACTION_ALIAS_CHANGED);
|
filterGlobal.addAction(BLUETOOTH_DEVICE_ACTION_ALIAS_CHANGED);
|
||||||
filterGlobal.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
|
filterGlobal.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
|
||||||
context.registerReceiver(mReceiver, filterGlobal);
|
ContextCompat.registerReceiver(context, mReceiver, filterGlobal, ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
refreshPairedDevices();
|
refreshPairedDevices();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import android.os.Bundle;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
@ -238,7 +239,7 @@ public class MiBandPairingActivity extends AbstractGBActivity implements Bonding
|
|||||||
|
|
||||||
public void registerBroadcastReceivers() {
|
public void registerBroadcastReceivers() {
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
LocalBroadcastManager.getInstance(this).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||||
registerReceiver(bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
ContextCompat.registerReceiver(this, bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Context getContext() {
|
public Context getContext() {
|
||||||
|
@ -35,9 +35,11 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ServiceInfo;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@ -65,7 +67,6 @@ import nodomain.freeyourgadget.gadgetbridge.activities.HeartRateUtils;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.capabilities.loyaltycards.LoyaltyCard;
|
import nodomain.freeyourgadget.gadgetbridge.capabilities.loyaltycards.LoyaltyCard;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCameraRemote;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCameraRemote;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.huawei.packets.CameraRemote;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmClockReceiver;
|
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmClockReceiver;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmReceiver;
|
import nodomain.freeyourgadget.gadgetbridge.externalevents.AlarmReceiver;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothConnectReceiver;
|
import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothConnectReceiver;
|
||||||
@ -108,8 +109,8 @@ import nodomain.freeyourgadget.gadgetbridge.service.receivers.GBAutoFetchReceive
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
import nodomain.freeyourgadget.gadgetbridge.util.EmojiConverter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.LanguageUtils;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.language.LanguageUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.language.Transliterator;
|
import nodomain.freeyourgadget.gadgetbridge.util.language.Transliterator;
|
||||||
|
|
||||||
public class DeviceCommunicationService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener {
|
public class DeviceCommunicationService extends Service implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||||
@ -501,20 +502,20 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
|
|
||||||
private void registerExternalReceivers(){
|
private void registerExternalReceivers(){
|
||||||
mBlueToothConnectReceiver = new BluetoothConnectReceiver(this);
|
mBlueToothConnectReceiver = new BluetoothConnectReceiver(this);
|
||||||
registerReceiver(mBlueToothConnectReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED));
|
ContextCompat.registerReceiver(this, mBlueToothConnectReceiver, new IntentFilter(BluetoothDevice.ACTION_ACL_CONNECTED), ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
mAutoConnectInvervalReceiver= new AutoConnectIntervalReceiver(this);
|
mAutoConnectInvervalReceiver= new AutoConnectIntervalReceiver(this);
|
||||||
registerReceiver(mAutoConnectInvervalReceiver, new IntentFilter("GB_RECONNECT"));
|
ContextCompat.registerReceiver(this, mAutoConnectInvervalReceiver, new IntentFilter("GB_RECONNECT"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
IntentFilter bluetoothCommandFilter = new IntentFilter();
|
IntentFilter bluetoothCommandFilter = new IntentFilter();
|
||||||
bluetoothCommandFilter.addAction(COMMAND_BLUETOOTH_CONNECT);
|
bluetoothCommandFilter.addAction(COMMAND_BLUETOOTH_CONNECT);
|
||||||
registerReceiver(bluetoothCommandReceiver, bluetoothCommandFilter);
|
ContextCompat.registerReceiver(this, bluetoothCommandReceiver, bluetoothCommandFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
final IntentFilter deviceSettingsIntentFilter = new IntentFilter();
|
final IntentFilter deviceSettingsIntentFilter = new IntentFilter();
|
||||||
deviceSettingsIntentFilter.addAction(DeviceSettingsReceiver.COMMAND);
|
deviceSettingsIntentFilter.addAction(DeviceSettingsReceiver.COMMAND);
|
||||||
registerReceiver(deviceSettingsReceiver, deviceSettingsIntentFilter);
|
ContextCompat.registerReceiver(this, deviceSettingsReceiver, deviceSettingsIntentFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
|
|
||||||
registerReceiver(intentApiReceiver, intentApiReceiver.buildFilter());
|
ContextCompat.registerReceiver(this, intentApiReceiver, intentApiReceiver.buildFilter(), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1204,8 +1205,12 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
|
|
||||||
private void startForeground() {
|
private void startForeground() {
|
||||||
GB.createNotificationChannels(this);
|
GB.createNotificationChannels(this);
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this), ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
|
||||||
|
} else {
|
||||||
startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this));
|
startForeground(GB.NOTIFICATION_ID, GB.createNotification(getString(R.string.gadgetbridge_running), this));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isDeviceConnected(GBDevice device) {
|
private boolean isDeviceConnected(GBDevice device) {
|
||||||
return isDeviceConnected(device.getAddress());
|
return isDeviceConnected(device.getAddress());
|
||||||
@ -1289,16 +1294,16 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
calendarIntentFilter.addDataScheme("content");
|
calendarIntentFilter.addDataScheme("content");
|
||||||
calendarIntentFilter.addDataAuthority("com.android.calendar", null);
|
calendarIntentFilter.addDataAuthority("com.android.calendar", null);
|
||||||
CalendarReceiver receiver = new CalendarReceiver(deviceWithCalendar);
|
CalendarReceiver receiver = new CalendarReceiver(deviceWithCalendar);
|
||||||
registerReceiver(receiver, calendarIntentFilter);
|
ContextCompat.registerReceiver(this, receiver, calendarIntentFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
mCalendarReceiver.add(receiver);
|
mCalendarReceiver.add(receiver);
|
||||||
// Add a receiver to allow us to quickly force as calendar sync (without having to provide data)
|
// Add a receiver to allow us to quickly force as calendar sync (without having to provide data)
|
||||||
registerReceiver(receiver, new IntentFilter("FORCE_CALENDAR_SYNC"));
|
ContextCompat.registerReceiver(this, receiver, new IntentFilter("FORCE_CALENDAR_SYNC"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mAlarmReceiver == null) {
|
if (mAlarmReceiver == null) {
|
||||||
mAlarmReceiver = new AlarmReceiver();
|
mAlarmReceiver = new AlarmReceiver();
|
||||||
registerReceiver(mAlarmReceiver, new IntentFilter("DAILY_ALARM"));
|
ContextCompat.registerReceiver(this, mAlarmReceiver, new IntentFilter("DAILY_ALARM"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (CalendarReceiver registeredReceiver: mCalendarReceiver){
|
for (CalendarReceiver registeredReceiver: mCalendarReceiver){
|
||||||
@ -1318,15 +1323,15 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
filter.addAction("android.intent.action.PHONE_STATE");
|
filter.addAction("android.intent.action.PHONE_STATE");
|
||||||
filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
|
filter.addAction("android.intent.action.NEW_OUTGOING_CALL");
|
||||||
filter.addAction("nodomain.freeyourgadget.gadgetbridge.MUTE_CALL");
|
filter.addAction("nodomain.freeyourgadget.gadgetbridge.MUTE_CALL");
|
||||||
registerReceiver(mPhoneCallReceiver, filter);
|
ContextCompat.registerReceiver(this, mPhoneCallReceiver, filter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mSMSReceiver == null) {
|
if (mSMSReceiver == null) {
|
||||||
mSMSReceiver = new SMSReceiver();
|
mSMSReceiver = new SMSReceiver();
|
||||||
registerReceiver(mSMSReceiver, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"));
|
ContextCompat.registerReceiver(this, mSMSReceiver, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mPebbleReceiver == null) {
|
if (mPebbleReceiver == null) {
|
||||||
mPebbleReceiver = new PebbleReceiver();
|
mPebbleReceiver = new PebbleReceiver();
|
||||||
registerReceiver(mPebbleReceiver, new IntentFilter("com.getpebble.action.SEND_NOTIFICATION"));
|
ContextCompat.registerReceiver(this, mPebbleReceiver, new IntentFilter("com.getpebble.action.SEND_NOTIFICATION"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mMusicPlaybackReceiver == null && features.supportsMusicInfo()) {
|
if (mMusicPlaybackReceiver == null && features.supportsMusicInfo()) {
|
||||||
mMusicPlaybackReceiver = new MusicPlaybackReceiver();
|
mMusicPlaybackReceiver = new MusicPlaybackReceiver();
|
||||||
@ -1334,7 +1339,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
for (String action : mMusicActions) {
|
for (String action : mMusicActions) {
|
||||||
filter.addAction(action);
|
filter.addAction(action);
|
||||||
}
|
}
|
||||||
registerReceiver(mMusicPlaybackReceiver, filter);
|
ContextCompat.registerReceiver(this, mMusicPlaybackReceiver, filter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mTimeChangeReceiver == null) {
|
if (mTimeChangeReceiver == null) {
|
||||||
mTimeChangeReceiver = new TimeChangeReceiver();
|
mTimeChangeReceiver = new TimeChangeReceiver();
|
||||||
@ -1342,14 +1347,14 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
filter.addAction("android.intent.action.TIME_SET");
|
filter.addAction("android.intent.action.TIME_SET");
|
||||||
filter.addAction("android.intent.action.TIMEZONE_CHANGED");
|
filter.addAction("android.intent.action.TIMEZONE_CHANGED");
|
||||||
filter.addAction(TimeChangeReceiver.ACTION_DST_CHANGED_OR_PERIODIC_SYNC);
|
filter.addAction(TimeChangeReceiver.ACTION_DST_CHANGED_OR_PERIODIC_SYNC);
|
||||||
registerReceiver(mTimeChangeReceiver, filter);
|
ContextCompat.registerReceiver(this, mTimeChangeReceiver, filter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
// Ensure alarm is scheduled after registering broadcast receiver
|
// Ensure alarm is scheduled after registering broadcast receiver
|
||||||
// (this is important in case receiver was unregistered when the previous alarm arrived).
|
// (this is important in case receiver was unregistered when the previous alarm arrived).
|
||||||
TimeChangeReceiver.ifEnabledScheduleNextDstChangeOrPeriodicSync(this);
|
TimeChangeReceiver.ifEnabledScheduleNextDstChangeOrPeriodicSync(this);
|
||||||
}
|
}
|
||||||
if (mBlueToothPairingRequestReceiver == null) {
|
if (mBlueToothPairingRequestReceiver == null) {
|
||||||
mBlueToothPairingRequestReceiver = new BluetoothPairingRequestReceiver(this);
|
mBlueToothPairingRequestReceiver = new BluetoothPairingRequestReceiver(this);
|
||||||
registerReceiver(mBlueToothPairingRequestReceiver, new IntentFilter(BluetoothDevice.ACTION_PAIRING_REQUEST));
|
ContextCompat.registerReceiver(this, mBlueToothPairingRequestReceiver, new IntentFilter(BluetoothDevice.ACTION_PAIRING_REQUEST), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mAlarmClockReceiver == null) {
|
if (mAlarmClockReceiver == null) {
|
||||||
mAlarmClockReceiver = new AlarmClockReceiver();
|
mAlarmClockReceiver = new AlarmClockReceiver();
|
||||||
@ -1358,14 +1363,14 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
filter.addAction(AlarmClockReceiver.ALARM_DONE_ACTION);
|
filter.addAction(AlarmClockReceiver.ALARM_DONE_ACTION);
|
||||||
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_ALERT_ACTION);
|
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_ALERT_ACTION);
|
||||||
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_DONE_ACTION);
|
filter.addAction(AlarmClockReceiver.GOOGLE_CLOCK_ALARM_DONE_ACTION);
|
||||||
registerReceiver(mAlarmClockReceiver, filter);
|
ContextCompat.registerReceiver(this, mAlarmClockReceiver, filter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSilentModeReceiver == null) {
|
if (mSilentModeReceiver == null) {
|
||||||
mSilentModeReceiver = new SilentModeReceiver();
|
mSilentModeReceiver = new SilentModeReceiver();
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
|
||||||
registerReceiver(mSilentModeReceiver, filter);
|
ContextCompat.registerReceiver(this, mSilentModeReceiver, filter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locationService == null) {
|
if (locationService == null) {
|
||||||
@ -1382,21 +1387,21 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
if (GBApplication.isRunningOreoOrLater()) {
|
if (GBApplication.isRunningOreoOrLater()) {
|
||||||
if (mLineageOsWeatherReceiver == null) {
|
if (mLineageOsWeatherReceiver == null) {
|
||||||
mLineageOsWeatherReceiver = new LineageOsWeatherReceiver();
|
mLineageOsWeatherReceiver = new LineageOsWeatherReceiver();
|
||||||
registerReceiver(mLineageOsWeatherReceiver, new IntentFilter("GB_UPDATE_WEATHER"));
|
ContextCompat.registerReceiver(this, mLineageOsWeatherReceiver, new IntentFilter("GB_UPDATE_WEATHER"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mCMWeatherReceiver == null) {
|
if (mCMWeatherReceiver == null) {
|
||||||
mCMWeatherReceiver = new CMWeatherReceiver();
|
mCMWeatherReceiver = new CMWeatherReceiver();
|
||||||
registerReceiver(mCMWeatherReceiver, new IntentFilter("GB_UPDATE_WEATHER"));
|
ContextCompat.registerReceiver(this, mCMWeatherReceiver, new IntentFilter("GB_UPDATE_WEATHER"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mTinyWeatherForecastGermanyReceiver == null) {
|
if (mTinyWeatherForecastGermanyReceiver == null) {
|
||||||
mTinyWeatherForecastGermanyReceiver = new TinyWeatherForecastGermanyReceiver();
|
mTinyWeatherForecastGermanyReceiver = new TinyWeatherForecastGermanyReceiver();
|
||||||
registerReceiver(mTinyWeatherForecastGermanyReceiver, new IntentFilter("de.kaffeemitkoffein.broadcast.WEATHERDATA"));
|
ContextCompat.registerReceiver(this, mTinyWeatherForecastGermanyReceiver, new IntentFilter("de.kaffeemitkoffein.broadcast.WEATHERDATA"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mGenericWeatherReceiver == null) {
|
if (mGenericWeatherReceiver == null) {
|
||||||
mGenericWeatherReceiver = new GenericWeatherReceiver();
|
mGenericWeatherReceiver = new GenericWeatherReceiver();
|
||||||
registerReceiver(mGenericWeatherReceiver, new IntentFilter(GenericWeatherReceiver.ACTION_GENERIC_WEATHER));
|
ContextCompat.registerReceiver(this, mGenericWeatherReceiver, new IntentFilter(GenericWeatherReceiver.ACTION_GENERIC_WEATHER), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
if (mOmniJawsObserver == null) {
|
if (mOmniJawsObserver == null) {
|
||||||
try {
|
try {
|
||||||
@ -1412,14 +1417,14 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||||||
{
|
{
|
||||||
if (mSleepAsAndroidReceiver == null) {
|
if (mSleepAsAndroidReceiver == null) {
|
||||||
mSleepAsAndroidReceiver = new SleepAsAndroidReceiver();
|
mSleepAsAndroidReceiver = new SleepAsAndroidReceiver();
|
||||||
registerReceiver(mSleepAsAndroidReceiver, new IntentFilter());
|
ContextCompat.registerReceiver(this, mSleepAsAndroidReceiver, new IntentFilter(), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GBApplication.getPrefs().getBoolean("auto_fetch_enabled", false) &&
|
if (GBApplication.getPrefs().getBoolean("auto_fetch_enabled", false) &&
|
||||||
features.supportsActivityDataFetching() && mGBAutoFetchReceiver == null) {
|
features.supportsActivityDataFetching() && mGBAutoFetchReceiver == null) {
|
||||||
mGBAutoFetchReceiver = new GBAutoFetchReceiver();
|
mGBAutoFetchReceiver = new GBAutoFetchReceiver();
|
||||||
registerReceiver(mGBAutoFetchReceiver, new IntentFilter("android.intent.action.USER_PRESENT"));
|
ContextCompat.registerReceiver(this, mGBAutoFetchReceiver, new IntentFilter("android.intent.action.USER_PRESENT"), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mPhoneCallReceiver != null) {
|
if (mPhoneCallReceiver != null) {
|
||||||
|
@ -35,12 +35,14 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ServiceInfo;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -215,8 +217,12 @@ public class BLEScanService extends Service {
|
|||||||
private void startForeground() {
|
private void startForeground() {
|
||||||
Notification serviceNotification = createNotification(false, 0);
|
Notification serviceNotification = createNotification(false, 0);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
|
super.startForeground(GB.NOTIFICATION_ID_SCAN, serviceNotification, ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE);
|
||||||
|
} else {
|
||||||
super.startForeground(GB.NOTIFICATION_ID_SCAN, serviceNotification);
|
super.startForeground(GB.NOTIFICATION_ID_SCAN, serviceNotification);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
@ -315,9 +321,11 @@ public class BLEScanService extends Service {
|
|||||||
filter
|
filter
|
||||||
);
|
);
|
||||||
|
|
||||||
registerReceiver(
|
ContextCompat.registerReceiver(
|
||||||
|
this,
|
||||||
bluetoothStateChangedReceiver,
|
bluetoothStateChangedReceiver,
|
||||||
new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED)
|
new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED),
|
||||||
|
ContextCompat.RECEIVER_EXPORTED
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
@ -65,7 +66,7 @@ public class BondAction extends PlainAction implements BondingInterface {
|
|||||||
@Override
|
@Override
|
||||||
public void registerBroadcastReceivers() {
|
public void registerBroadcastReceivers() {
|
||||||
LocalBroadcastManager.getInstance(GBApplication.getContext()).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
LocalBroadcastManager.getInstance(GBApplication.getContext()).registerReceiver(pairingReceiver, new IntentFilter(GBDevice.ACTION_DEVICE_CHANGED));
|
||||||
getContext().registerReceiver(bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED));
|
ContextCompat.registerReceiver(getContext(), bondingReceiver, new IntentFilter(BluetoothDevice.ACTION_BOND_STATE_CHANGED), ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,12 +24,11 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
||||||
@ -127,7 +126,7 @@ public class FlipperZeroSupport extends FlipperZeroBaseSupport{
|
|||||||
@Override
|
@Override
|
||||||
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
|
||||||
if(!recevierRegistered) {
|
if(!recevierRegistered) {
|
||||||
getContext().registerReceiver(receiver, new IntentFilter(COMMAND_PLAY_FILE));
|
ContextCompat.registerReceiver(getContext(), receiver, new IntentFilter(COMMAND_PLAY_FILE), ContextCompat.RECEIVER_EXPORTED);
|
||||||
recevierRegistered = true;
|
recevierRegistered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -131,7 +133,7 @@ class PebbleKitSupport {
|
|||||||
intentFilter.addAction(PEBBLEKIT_ACTION_APP_START);
|
intentFilter.addAction(PEBBLEKIT_ACTION_APP_START);
|
||||||
intentFilter.addAction(PEBBLEKIT_ACTION_APP_STOP);
|
intentFilter.addAction(PEBBLEKIT_ACTION_APP_STOP);
|
||||||
intentFilter.addAction(PEBBLEKIT_ACTION_DL_ACK_DATA);
|
intentFilter.addAction(PEBBLEKIT_ACTION_DL_ACK_DATA);
|
||||||
mContext.registerReceiver(mPebbleKitReceiver, intentFilter);
|
ContextCompat.registerReceiver(mContext, mPebbleKitReceiver, intentFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendAppMessageIntent(GBDeviceEventAppMessage appMessage) {
|
void sendAppMessageIntent(GBDeviceEventAppMessage appMessage) {
|
||||||
|
@ -28,6 +28,7 @@ import android.net.Uri;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -393,7 +394,7 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
GBApplication.getContext().registerReceiver(globalCommandReceiver, globalFilter);
|
ContextCompat.registerReceiver(GBApplication.getContext(), globalCommandReceiver, globalFilter, ContextCompat.RECEIVER_EXPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleConfigSetIntent(Intent intent) {
|
private void handleConfigSetIntent(Intent intent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user