mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-23 16:17:32 +01:00
Remove KitKat support
This commit is contained in:
parent
2e6be6bea3
commit
969164ba5d
@ -42,16 +42,16 @@ def getGitHashShort = { ->
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileOptions {
|
compileOptions {
|
||||||
// for KitKat
|
// for Android 5+
|
||||||
sourceCompatibility JavaVersion.VERSION_1_7
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
targetCompatibility JavaVersion.VERSION_1_7
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
}
|
}
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion "31.0.0"
|
buildToolsVersion "31.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "nodomain.freeyourgadget.gadgetbridge"
|
applicationId "nodomain.freeyourgadget.gadgetbridge"
|
||||||
minSdkVersion 19
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class GBApplication extends Application {
|
|||||||
private static GBPrefs gbPrefs;
|
private static GBPrefs gbPrefs;
|
||||||
private static LockHandler lockHandler;
|
private static LockHandler lockHandler;
|
||||||
/**
|
/**
|
||||||
* Note: is null on Lollipop and Kitkat
|
* Note: is null on Lollipop
|
||||||
*/
|
*/
|
||||||
private static NotificationManager notificationManager;
|
private static NotificationManager notificationManager;
|
||||||
|
|
||||||
@ -377,10 +377,6 @@ public class GBApplication extends Application {
|
|||||||
dbLock.unlock();
|
dbLock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRunningLollipopOrLater() {
|
|
||||||
return VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isRunningMarshmallowOrLater() {
|
public static boolean isRunningMarshmallowOrLater() {
|
||||||
return VERSION.SDK_INT >= Build.VERSION_CODES.M;
|
return VERSION.SDK_INT >= Build.VERSION_CODES.M;
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,7 @@ public class SleepAlarmWidget extends AppWidgetProvider {
|
|||||||
alarms.add(alarm);
|
alarms.add(alarm);
|
||||||
GBApplication.deviceService(deviceForWidget).onSetAlarms(alarms);
|
GBApplication.deviceService(deviceForWidget).onSetAlarms(alarms);
|
||||||
|
|
||||||
// if (GBApplication.isRunningLollipopOrLater()) {
|
// setAlarmViaAlarmManager(context, calendar.getTimeInMillis());
|
||||||
// setAlarmViaAlarmManager(context, calendar.getTimeInMillis());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +143,6 @@ public class SleepAlarmWidget extends AppWidgetProvider {
|
|||||||
* @param triggerTime {@code long}: time at which the underlying alarm is triggered in wall time
|
* @param triggerTime {@code long}: time at which the underlying alarm is triggered in wall time
|
||||||
* milliseconds since the epoch
|
* milliseconds since the epoch
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private void setAlarmViaAlarmManager(Context packageContext, long triggerTime) {
|
private void setAlarmViaAlarmManager(Context packageContext, long triggerTime) {
|
||||||
AlarmManager am = (AlarmManager) packageContext.getSystemService(Context.ALARM_SERVICE);
|
AlarmManager am = (AlarmManager) packageContext.getSystemService(Context.ALARM_SERVICE);
|
||||||
// TODO: launch the alarm configuration activity when clicking the alarm in the status bar
|
// TODO: launch the alarm configuration activity when clicking the alarm in the status bar
|
||||||
|
@ -225,14 +225,12 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private ScanCallback getScanCallback() {
|
private ScanCallback getScanCallback() {
|
||||||
if (newBLEScanCallback != null) {
|
if (newBLEScanCallback != null) {
|
||||||
return newBLEScanCallback;
|
return newBLEScanCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
newBLEScanCallback = new ScanCallback() {
|
newBLEScanCallback = new ScanCallback() {
|
||||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
@Override
|
@Override
|
||||||
public void onScanResult(int callbackType, ScanResult result) {
|
public void onScanResult(int callbackType, ScanResult result) {
|
||||||
super.onScanResult(callbackType, result);
|
super.onScanResult(callbackType, result);
|
||||||
@ -371,9 +369,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
if (oldBleScanning) {
|
if (oldBleScanning) {
|
||||||
stopOldBLEDiscovery();
|
stopOldBLEDiscovery();
|
||||||
} else {
|
} else {
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
stopBLEDiscovery();
|
||||||
stopBLEDiscovery();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Error stopping discovery", e);
|
LOG.warn("Error stopping discovery", e);
|
||||||
@ -440,7 +436,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
if (what == Scanning.SCANNING_BT || what == Scanning.SCANNING_BT_NEXT_BLE) {
|
if (what == Scanning.SCANNING_BT || what == Scanning.SCANNING_BT_NEXT_BLE) {
|
||||||
startBTDiscovery(what);
|
startBTDiscovery(what);
|
||||||
} else if (what == Scanning.SCANNING_BLE && GB.supportsBluetoothLE()) {
|
} else if (what == Scanning.SCANNING_BLE && GB.supportsBluetoothLE()) {
|
||||||
if (oldBleScanning || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
if (oldBleScanning) {
|
||||||
startOldBTLEDiscovery();
|
startOldBTLEDiscovery();
|
||||||
} else {
|
} else {
|
||||||
startBTLEDiscovery();
|
startBTLEDiscovery();
|
||||||
@ -462,7 +458,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
if (wasScanning == Scanning.SCANNING_BT || wasScanning == Scanning.SCANNING_BT_NEXT_BLE) {
|
if (wasScanning == Scanning.SCANNING_BT || wasScanning == Scanning.SCANNING_BT_NEXT_BLE) {
|
||||||
stopBTDiscovery();
|
stopBTDiscovery();
|
||||||
} else if (wasScanning == Scanning.SCANNING_BLE) {
|
} else if (wasScanning == Scanning.SCANNING_BLE) {
|
||||||
if (oldBleScanning || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
if (oldBleScanning) {
|
||||||
stopOldBLEDiscovery();
|
stopOldBLEDiscovery();
|
||||||
} else {
|
} else {
|
||||||
stopBLEDiscovery();
|
stopBLEDiscovery();
|
||||||
@ -507,7 +503,6 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
/* New BTLE Discovery uses startScan (List<ScanFilter> filters,
|
/* New BTLE Discovery uses startScan (List<ScanFilter> filters,
|
||||||
ScanSettings settings,
|
ScanSettings settings,
|
||||||
ScanCallback callback) */
|
ScanCallback callback) */
|
||||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private void startBTLEDiscovery() {
|
private void startBTLEDiscovery() {
|
||||||
LOG.info("Starting BLE discovery");
|
LOG.info("Starting BLE discovery");
|
||||||
|
|
||||||
@ -523,7 +518,6 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
setIsScanning(Scanning.SCANNING_BLE);
|
setIsScanning(Scanning.SCANNING_BLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private void stopBLEDiscovery() {
|
private void stopBLEDiscovery() {
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
return;
|
return;
|
||||||
@ -652,7 +646,6 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
private ScanSettings getScanSettings() {
|
private ScanSettings getScanSettings() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
return new ScanSettings.Builder()
|
return new ScanSettings.Builder()
|
||||||
|
@ -187,20 +187,6 @@ public class DBHelper {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* WITHOUT ROWID is only available with sqlite 3.8.2, which is available
|
|
||||||
* with Lollipop and later.
|
|
||||||
*
|
|
||||||
* @return the "WITHOUT ROWID" string or an empty string for pre-Lollipop devices
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public static String getWithoutRowId() {
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
|
||||||
return " WITHOUT ROWID;";
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks up the user entity in the database. If a user exists already, it will
|
* Looks up the user entity in the database. If a user exists already, it will
|
||||||
* be updated with the current preferences values. If no user exists yet, it will
|
* be updated with the current preferences values. If no user exists yet, it will
|
||||||
|
@ -141,7 +141,6 @@ public interface DeviceCoordinator {
|
|||||||
* @return the list of scan filters, may be empty
|
* @return the list of scan filters, may be empty
|
||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
Collection<? extends ScanFilter> createBLEScanFilters();
|
Collection<? extends ScanFilter> createBLEScanFilters();
|
||||||
|
|
||||||
GBDevice createDevice(GBDeviceCandidate candidate);
|
GBDevice createDevice(GBDeviceCandidate candidate);
|
||||||
|
@ -144,11 +144,7 @@ public class AppsManagementActivity extends AbstractGBActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (webView==null) return; // webView may have gone by the time we get called!
|
if (webView==null) return; // webView may have gone by the time we get called!
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
|
webView.evaluateJavascript(js, null);
|
||||||
webView.evaluateJavascript(js, null);
|
|
||||||
} else {
|
|
||||||
webView.loadUrl("javascript: "+js);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,6 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
// TODO: filter on name beginning Bangle.js? Doesn't appear to be built-in :(
|
// TODO: filter on name beginning Bangle.js? Doesn't appear to be built-in :(
|
||||||
// https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setDeviceName(java.lang.String)
|
// https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setDeviceName(java.lang.String)
|
||||||
|
@ -63,7 +63,6 @@ public class HPlusCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid hpService = new ParcelUuid(HPlusConstants.UUID_SERVICE_HP);
|
ParcelUuid hpService = new ParcelUuid(HPlusConstants.UUID_SERVICE_HP);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(hpService).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(hpService).build();
|
||||||
|
@ -72,7 +72,6 @@ public abstract class HuamiCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid mi2Service = new ParcelUuid(MiBandService.UUID_SERVICE_MIBAND2_SERVICE);
|
ParcelUuid mi2Service = new ParcelUuid(MiBandService.UUID_SERVICE_MIBAND2_SERVICE);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(mi2Service).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(mi2Service).build();
|
||||||
|
@ -45,7 +45,6 @@ import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
|||||||
public class ID115Coordinator extends AbstractBLEDeviceCoordinator {
|
public class ID115Coordinator extends AbstractBLEDeviceCoordinator {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid service = new ParcelUuid(ID115Constants.UUID_SERVICE_ID115);
|
ParcelUuid service = new ParcelUuid(ID115Constants.UUID_SERVICE_ID115);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
|
||||||
|
@ -58,7 +58,6 @@ public class ITagCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ScanFilter filter = new ScanFilter.Builder()
|
ScanFilter filter = new ScanFilter.Builder()
|
||||||
.setDeviceName("iTag")
|
.setDeviceName("iTag")
|
||||||
|
@ -55,7 +55,6 @@ public class TeclastH30Coordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid uuid = new ParcelUuid(JYouConstants.UUID_SERVICE_JYOU);
|
ParcelUuid uuid = new ParcelUuid(JYouConstants.UUID_SERVICE_JYOU);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(uuid).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(uuid).build();
|
||||||
|
@ -69,7 +69,6 @@ public class WatchXPlusDeviceCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid watchXpService = new ParcelUuid(WatchXPlusConstants.UUID_SERVICE_WATCHXPLUS);
|
ParcelUuid watchXpService = new ParcelUuid(WatchXPlusConstants.UUID_SERVICE_WATCHXPLUS);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(watchXpService).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(watchXpService).build();
|
||||||
|
@ -62,7 +62,6 @@ public class MiBandCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid mi1Service = new ParcelUuid(MiBandService.UUID_SERVICE_MIBAND_SERVICE);
|
ParcelUuid mi1Service = new ParcelUuid(MiBandService.UUID_SERVICE_MIBAND_SERVICE);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(mi1Service).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(mi1Service).build();
|
||||||
|
@ -71,7 +71,6 @@ public class MiScale2DeviceCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid bodyCompositionService = new ParcelUuid(GattService.UUID_SERVICE_BODY_COMPOSITION);
|
ParcelUuid bodyCompositionService = new ParcelUuid(GattService.UUID_SERVICE_BODY_COMPOSITION);
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ public class No1F1Coordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid hpService = new ParcelUuid(No1F1Constants.UUID_SERVICE_NO1);
|
ParcelUuid hpService = new ParcelUuid(No1F1Constants.UUID_SERVICE_NO1);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(hpService).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(hpService).build();
|
||||||
|
@ -58,7 +58,6 @@ public class NutCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ScanFilter filter = new ScanFilter.Builder()
|
ScanFilter filter = new ScanFilter.Builder()
|
||||||
.setDeviceName("nut") // Nut Mini
|
.setDeviceName("nut") // Nut Mini
|
||||||
|
@ -70,7 +70,6 @@ public class QHybridCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
return DeviceType.UNKNOWN;
|
return DeviceType.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
|
@ -34,7 +34,6 @@ public class SMAQ2OSSCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid service = new ParcelUuid(SMAQ2OSSConstants.UUID_SERVICE_SMAQ2OSS);
|
ParcelUuid service = new ParcelUuid(SMAQ2OSSConstants.UUID_SERVICE_SMAQ2OSS);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(service).build();
|
||||||
|
@ -56,7 +56,6 @@ public class WaspOSCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
// TODO: filter on name beginning Bangle.js? Doesn't appear to be built-in :(
|
// TODO: filter on name beginning Bangle.js? Doesn't appear to be built-in :(
|
||||||
// https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setDeviceName(java.lang.String)
|
// https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder.html#setDeviceName(java.lang.String)
|
||||||
|
@ -49,7 +49,6 @@ public class Watch9DeviceCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
public Collection<? extends ScanFilter> createBLEScanFilters() {
|
||||||
ParcelUuid watch9Service = new ParcelUuid(Watch9Constants.UUID_SERVICE_WATCH9);
|
ParcelUuid watch9Service = new ParcelUuid(Watch9Constants.UUID_SERVICE_WATCH9);
|
||||||
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(watch9Service).build();
|
ScanFilter filter = new ScanFilter.Builder().setServiceUuid(watch9Service).build();
|
||||||
|
@ -186,15 +186,8 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
for (StatusBarNotification sbn : sbns) {
|
for (StatusBarNotification sbn : sbns) {
|
||||||
if (sbn.getPostTime() == ts) {
|
if (sbn.getPostTime() == ts) {
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
String key = sbn.getKey();
|
||||||
String key = sbn.getKey();
|
NotificationListener.this.cancelNotification(key);
|
||||||
NotificationListener.this.cancelNotification(key);
|
|
||||||
} else {
|
|
||||||
int id = sbn.getId();
|
|
||||||
String pkg = sbn.getPackageName();
|
|
||||||
String tag = sbn.getTag();
|
|
||||||
NotificationListener.this.cancelNotification(pkg, tag, id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -284,7 +277,7 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
if (handleMediaSessionNotification(sbn)) return;
|
if (handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
int dndSuppressed = 0;
|
int dndSuppressed = 0;
|
||||||
if (GBApplication.isRunningLollipopOrLater() && rankingMap != null) {
|
if (rankingMap != null) {
|
||||||
// Handle priority notifications for Do Not Disturb
|
// Handle priority notifications for Do Not Disturb
|
||||||
Ranking ranking = new Ranking();
|
Ranking ranking = new Ranking();
|
||||||
if (rankingMap.getRanking(sbn.getKey(), ranking)) {
|
if (rankingMap.getRanking(sbn.getKey(), ranking)) {
|
||||||
@ -293,16 +286,14 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
if (prefs.getBoolean("notification_filter", false) && dndSuppressed == 1) {
|
||||||
if (prefs.getBoolean("notification_filter", false) && dndSuppressed == 1) {
|
return;
|
||||||
return;
|
}
|
||||||
}
|
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
|
||||||
if (NotificationCompat.CATEGORY_CALL.equals(sbn.getNotification().category)
|
&& prefs.getBoolean("notification_support_voip_calls", false)
|
||||||
&& prefs.getBoolean("notification_support_voip_calls", false)
|
&& sbn.isOngoing()) {
|
||||||
&& sbn.isOngoing()) {
|
handleCallNotification(sbn);
|
||||||
handleCallNotification(sbn);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldIgnoreNotification(sbn, false)) {
|
if (shouldIgnoreNotification(sbn, false)) {
|
||||||
@ -735,15 +726,13 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
|
|
||||||
if (handleMediaSessionNotification(sbn)) return;
|
if (handleMediaSessionNotification(sbn)) return;
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
||||||
if(Notification.CATEGORY_CALL.equals(sbn.getNotification().category)
|
&& activeCallPostTime == sbn.getPostTime()) {
|
||||||
&& activeCallPostTime == sbn.getPostTime()) {
|
activeCallPostTime = 0;
|
||||||
activeCallPostTime = 0;
|
CallSpec callSpec = new CallSpec();
|
||||||
CallSpec callSpec = new CallSpec();
|
callSpec.command = CallSpec.CALL_END;
|
||||||
callSpec.command = CallSpec.CALL_END;
|
mLastCallCommand = callSpec.command;
|
||||||
mLastCallCommand = callSpec.command;
|
GBApplication.deviceService().onSetCallState(callSpec);
|
||||||
GBApplication.deviceService().onSetCallState(callSpec);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldIgnoreNotification(sbn, true)) return;
|
if (shouldIgnoreNotification(sbn, true)) return;
|
||||||
@ -790,9 +779,7 @@ public class NotificationListener extends NotificationListenerService {
|
|||||||
sbn.getPackageName()
|
sbn.getPackageName()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
infoMsg += ": " + sbn.getNotification().category;
|
||||||
infoMsg += ": " + sbn.getNotification().category;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG.debug(infoMsg);
|
LOG.debug(infoMsg);
|
||||||
}
|
}
|
||||||
|
@ -452,12 +452,8 @@ public class GBDeviceService implements DeviceService {
|
|||||||
* @return contact DisplayName, if found it
|
* @return contact DisplayName, if found it
|
||||||
*/
|
*/
|
||||||
private String getContactDisplayNameByNumber(String number) {
|
private String getContactDisplayNameByNumber(String number) {
|
||||||
Uri uri;
|
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, Uri.encode(number));
|
||||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI, Uri.encode(number));
|
|
||||||
} else {
|
|
||||||
uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
|
|
||||||
}
|
|
||||||
String name = number;
|
String name = number;
|
||||||
|
|
||||||
if (number == null || number.equals("")) {
|
if (number == null || number.equals("")) {
|
||||||
|
@ -60,7 +60,6 @@ public class TransactionBuilder {
|
|||||||
return add(action);
|
return add(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public TransactionBuilder requestMtu(int mtu){
|
public TransactionBuilder requestMtu(int mtu){
|
||||||
return add(
|
return add(
|
||||||
new RequestMtuAction(mtu)
|
new RequestMtuAction(mtu)
|
||||||
|
@ -27,7 +27,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.BtLEAction;
|
|||||||
public class RequestMtuAction extends BtLEAction {
|
public class RequestMtuAction extends BtLEAction {
|
||||||
private int mtu;
|
private int mtu;
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public RequestMtuAction(int mtu) {
|
public RequestMtuAction(int mtu) {
|
||||||
super(null);
|
super(null);
|
||||||
this.mtu = mtu;
|
this.mtu = mtu;
|
||||||
@ -39,7 +38,6 @@ public class RequestMtuAction extends BtLEAction {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(BluetoothGatt gatt) {
|
public boolean run(BluetoothGatt gatt) {
|
||||||
return gatt.requestMtu(this.mtu);
|
return gatt.requestMtu(this.mtu);
|
||||||
|
@ -2062,10 +2062,6 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void requestMTU(int mtu) {
|
protected void requestMTU(int mtu) {
|
||||||
if (!GBApplication.isRunningLollipopOrLater()) {
|
|
||||||
LOG.warn("Requesting MTU is only supported in Lollipop or later");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new TransactionBuilder("requestMtu")
|
new TransactionBuilder("requestMtu")
|
||||||
.requestMtu(mtu)
|
.requestMtu(mtu)
|
||||||
.queue(getQueue());
|
.queue(getQueue());
|
||||||
|
@ -140,9 +140,7 @@ class PebbleGATTClient extends BluetoothGattCallback {
|
|||||||
subscribeToConnectionParams(gatt);
|
subscribeToConnectionParams(gatt);
|
||||||
}
|
}
|
||||||
} else if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) {
|
} else if (characteristic.getUuid().equals(MTU_CHARACTERISTIC)) {
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
gatt.requestMtu(339);
|
||||||
gatt.requestMtu(339);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ public class GBWebClient extends WebViewClient {
|
|||||||
};
|
};
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GBWebClient.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GBWebClient.class);
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
|
||||||
Uri parsedUri = request.getUrl();
|
Uri parsedUri = request.getUrl();
|
||||||
@ -131,16 +130,12 @@ public class GBWebClient extends WebViewClient {
|
|||||||
|
|
||||||
private WebResourceResponse mimicRawGitResponse(String path) {
|
private WebResourceResponse mimicRawGitResponse(String path) {
|
||||||
if("/aHcVolle/TrekVolle/master/online.html".equals(path)) { //TrekVolle online check
|
if("/aHcVolle/TrekVolle/master/online.html".equals(path)) { //TrekVolle online check
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
Map<String, String> headers = new HashMap<>();
|
||||||
Map<String, String> headers = new HashMap<>();
|
headers.put("Access-Control-Allow-Origin", "*");
|
||||||
headers.put("Access-Control-Allow-Origin", "*");
|
return new WebResourceResponse("text/html", "utf-8", 200, "OK",
|
||||||
return new WebResourceResponse("text/html", "utf-8", 200, "OK",
|
headers,
|
||||||
headers,
|
new ByteArrayInputStream("1".getBytes())
|
||||||
new ByteArrayInputStream("1".getBytes())
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return new WebResourceResponse("text/html", "utf-8", new ByteArrayInputStream("1".getBytes()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -190,14 +185,10 @@ public class GBWebClient extends WebViewClient {
|
|||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("Access-Control-Allow-Origin", "*");
|
headers.put("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
return new WebResourceResponse("application/json", "utf-8", 200, "OK",
|
||||||
return new WebResourceResponse("application/json", "utf-8", 200, "OK",
|
headers,
|
||||||
headers,
|
new ByteArrayInputStream(resp.toString().getBytes())
|
||||||
new ByteArrayInputStream(resp.toString().getBytes())
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return new WebResourceResponse("application/json", "utf-8", new ByteArrayInputStream(resp.toString().getBytes()));
|
|
||||||
}
|
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
LOG.warn("Error building the JSON weather message.", e);
|
LOG.warn("Error building the JSON weather message.", e);
|
||||||
}
|
}
|
||||||
|
@ -739,11 +739,7 @@ public class QHybridSupport extends QHybridBaseSupport {
|
|||||||
|
|
||||||
PendingIntent intent = PendingIntent.getActivity(getContext(), 0, emailIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent intent = PendingIntent.getActivity(getContext(), 0, emailIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
|
notificationBuilder.addAction(new Notification.Action(0, "report", intent));
|
||||||
notificationBuilder.addAction(new Notification.Action(0, "report", intent));
|
|
||||||
}else{
|
|
||||||
notificationBuilder.addAction(0, "report", intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
GB.notify((int) System.currentTimeMillis(), notificationBuilder.build(), getContext());
|
GB.notify((int) System.currentTimeMillis(), notificationBuilder.build(), getContext());
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,8 @@ public class FossilWatchAdapter extends WatchAdapter {
|
|||||||
timeoutThread.start();
|
timeoutThread.start();
|
||||||
|
|
||||||
playPairingAnimation();
|
playPairingAnimation();
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
queueWrite(new RequestMtuRequest(512), false);
|
queueWrite(new RequestMtuRequest(512), false);
|
||||||
}
|
|
||||||
|
|
||||||
getDeviceInfos();
|
getDeviceInfos();
|
||||||
}
|
}
|
||||||
@ -801,13 +800,11 @@ public class FossilWatchAdapter extends WatchAdapter {
|
|||||||
log("dropping requetst " + request.getName());
|
log("dropping requetst " + request.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
new TransactionBuilder("requestMtu")
|
||||||
new TransactionBuilder("requestMtu")
|
.requestMtu(512)
|
||||||
.requestMtu(512)
|
.queue(getDeviceSupport().getQueue());
|
||||||
.queue(getDeviceSupport().getQueue());
|
|
||||||
|
|
||||||
this.fossilRequest = request;
|
this.fossilRequest = request;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void log(String message) {
|
private void log(String message) {
|
||||||
|
@ -222,9 +222,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
|
|
||||||
saveRawActivityFiles = getDeviceSpecificPreferences().getBoolean("save_raw_activity_files", false);
|
saveRawActivityFiles = getDeviceSpecificPreferences().getBoolean("save_raw_activity_files", false);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
queueWrite(new RequestMtuRequest(512));
|
||||||
queueWrite(new RequestMtuRequest(512));
|
|
||||||
}
|
|
||||||
|
|
||||||
listApplications();
|
listApplications();
|
||||||
getDeviceInfos();
|
getDeviceInfos();
|
||||||
|
@ -24,7 +24,6 @@ public class RequestMtuRequest extends FossilRequest {
|
|||||||
private int mtu;
|
private int mtu;
|
||||||
private boolean finished = false;
|
private boolean finished = false;
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public RequestMtuRequest(int mtu) {
|
public RequestMtuRequest(int mtu) {
|
||||||
this.mtu = mtu;
|
this.mtu = mtu;
|
||||||
}
|
}
|
||||||
|
@ -115,22 +115,21 @@ public class GBMusicControlReceiver extends BroadcastReceiver {
|
|||||||
private String getAudioPlayer(Context context) {
|
private String getAudioPlayer(Context context) {
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
String audioPlayer = prefs.getString("audio_player", "default");
|
String audioPlayer = prefs.getString("audio_player", "default");
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
MediaSessionManager mediaSessionManager =
|
||||||
MediaSessionManager mediaSessionManager =
|
(MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE);
|
||||||
(MediaSessionManager) context.getSystemService(Context.MEDIA_SESSION_SERVICE);
|
try {
|
||||||
|
List<MediaController> controllers = mediaSessionManager.getActiveSessions(
|
||||||
|
new ComponentName(context, NotificationListener.class));
|
||||||
try {
|
try {
|
||||||
List<MediaController> controllers = mediaSessionManager.getActiveSessions(
|
MediaController controller = controllers.get(0);
|
||||||
new ComponentName(context, NotificationListener.class));
|
audioPlayer = controller.getPackageName();
|
||||||
try {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
MediaController controller = controllers.get(0);
|
LOG.error("No media controller available", e);
|
||||||
audioPlayer = controller.getPackageName();
|
|
||||||
} catch (IndexOutOfBoundsException e) {
|
|
||||||
LOG.error("No media controller available", e);
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
LOG.warn("No permission to get media sessions - did not grant notification access?", e);
|
|
||||||
}
|
}
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
LOG.warn("No permission to get media sessions - did not grant notification access?", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return audioPlayer;
|
return audioPlayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,7 @@ public class AndroidUtils {
|
|||||||
String selection = null;
|
String selection = null;
|
||||||
String[] selectionArgs = null;
|
String[] selectionArgs = null;
|
||||||
|
|
||||||
// Uri is different in versions after KITKAT (Android 4.4), we need to
|
if (DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) {
|
||||||
if (Build.VERSION.SDK_INT >= 19 && DocumentsContract.isDocumentUri(context.getApplicationContext(), uri)) {
|
|
||||||
if ("com.android.externalstorage.documents".equals(uri.getAuthority())) {
|
if ("com.android.externalstorage.documents".equals(uri.getAuthority())) {
|
||||||
final String docId = DocumentsContract.getDocumentId(uri);
|
final String docId = DocumentsContract.getDocumentId(uri);
|
||||||
final String[] split = docId.split(":");
|
final String[] split = docId.split(":");
|
||||||
|
@ -265,16 +265,7 @@ public class FileUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!GBEnvironment.env().isLocalTest()) { // don't do this with robolectric
|
if (!GBEnvironment.env().isLocalTest()) { // don't do this with robolectric
|
||||||
final String storageState;
|
final String storageState = Environment.getExternalStorageState(dir);
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
storageState = Environment.getExternalStorageState(dir);
|
|
||||||
} else if(i == 0) {
|
|
||||||
// the first directory is also the primary external storage, i.e. the same as Environment.getExternalFilesDir()
|
|
||||||
storageState = Environment.getExternalStorageState();
|
|
||||||
} else {
|
|
||||||
// Assume it is mounted on older android versions - we test writing later
|
|
||||||
storageState = Environment.MEDIA_MOUNTED;
|
|
||||||
}
|
|
||||||
if (!Environment.MEDIA_MOUNTED.equals(storageState)) {
|
if (!Environment.MEDIA_MOUNTED.equals(storageState)) {
|
||||||
GB.log("ignoring '" + storageState + "' external storage dir: " + dir, GB.INFO, null);
|
GB.log("ignoring '" + storageState + "' external storage dir: " + dir, GB.INFO, null);
|
||||||
continue;
|
continue;
|
||||||
|
@ -190,7 +190,7 @@ public class GB {
|
|||||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_DISCONNECT);
|
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_DISCONNECT);
|
||||||
PendingIntent disconnectPendingIntent = PendingIntent.getService(context, 0, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent disconnectPendingIntent = PendingIntent.getService(context, 0, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
builder.addAction(R.drawable.ic_notification_disconnected, context.getString(R.string.controlcenter_disconnect), disconnectPendingIntent);
|
builder.addAction(R.drawable.ic_notification_disconnected, context.getString(R.string.controlcenter_disconnect), disconnectPendingIntent);
|
||||||
if (GBApplication.isRunningLollipopOrLater() && DeviceHelper.getInstance().getCoordinator(device).supportsActivityDataFetching()) { //for some reason this fails on KK
|
if (DeviceHelper.getInstance().getCoordinator(device).supportsActivityDataFetching()) {
|
||||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_FETCH_RECORDED_DATA);
|
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_FETCH_RECORDED_DATA);
|
||||||
deviceCommunicationServiceIntent.putExtra(EXTRA_RECORDED_DATA_TYPES, ActivityKind.TYPE_ACTIVITY);
|
deviceCommunicationServiceIntent.putExtra(EXTRA_RECORDED_DATA_TYPES, ActivityKind.TYPE_ACTIVITY);
|
||||||
PendingIntent fetchPendingIntent = PendingIntent.getService(context, 1, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent fetchPendingIntent = PendingIntent.getService(context, 1, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
@ -239,7 +239,7 @@ public class GB {
|
|||||||
builder.setColor(context.getResources().getColor(R.color.accent));
|
builder.setColor(context.getResources().getColor(R.color.accent));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater() && anyDeviceSupportesActivityDataFetching) { //for some reason this fails on KK
|
if (anyDeviceSupportesActivityDataFetching) {
|
||||||
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
||||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_FETCH_RECORDED_DATA);
|
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_FETCH_RECORDED_DATA);
|
||||||
deviceCommunicationServiceIntent.putExtra(EXTRA_RECORDED_DATA_TYPES, ActivityKind.TYPE_ACTIVITY);
|
deviceCommunicationServiceIntent.putExtra(EXTRA_RECORDED_DATA_TYPES, ActivityKind.TYPE_ACTIVITY);
|
||||||
@ -248,9 +248,8 @@ public class GB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||||
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
|
||||||
}
|
|
||||||
if (GBApplication.minimizeNotification()) {
|
if (GBApplication.minimizeNotification()) {
|
||||||
builder.setPriority(Notification.PRIORITY_MIN);
|
builder.setPriority(Notification.PRIORITY_MIN);
|
||||||
}
|
}
|
||||||
@ -276,9 +275,9 @@ public class GB {
|
|||||||
PendingIntent reconnectPendingIntent = PendingIntent.getService(context, 2, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
PendingIntent reconnectPendingIntent = PendingIntent.getService(context, 2, deviceCommunicationServiceIntent, PendingIntent.FLAG_ONE_SHOT);
|
||||||
builder.addAction(R.drawable.ic_notification, context.getString(R.string.controlcenter_connect), reconnectPendingIntent);
|
builder.addAction(R.drawable.ic_notification, context.getString(R.string.controlcenter_connect), reconnectPendingIntent);
|
||||||
}
|
}
|
||||||
if (GBApplication.isRunningLollipopOrLater()) {
|
|
||||||
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
||||||
}
|
|
||||||
if (GBApplication.minimizeNotification()) {
|
if (GBApplication.minimizeNotification()) {
|
||||||
builder.setPriority(Notification.PRIORITY_MIN);
|
builder.setPriority(Notification.PRIORITY_MIN);
|
||||||
}
|
}
|
||||||
|
@ -138,14 +138,10 @@ public class WebViewSingleton {
|
|||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("Access-Control-Allow-Origin", "*");
|
headers.put("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
internetResponse = new WebResourceResponse(data.getString("content-type"), data.getString("content-encoding"), 200, "OK",
|
||||||
internetResponse = new WebResourceResponse(data.getString("content-type"), data.getString("content-encoding"), 200, "OK",
|
headers,
|
||||||
headers,
|
new ByteArrayInputStream(data.getString("response").getBytes(Charset.forName(getCharsetFromHeaders(data.getString("content-type")))))
|
||||||
new ByteArrayInputStream(data.getString("response").getBytes(Charset.forName(getCharsetFromHeaders(data.getString("content-type")))))
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
internetResponse = new WebResourceResponse(data.getString("content-type"), data.getString("content-encoding"), new ByteArrayInputStream(data.getString("response").getBytes(Charset.forName(getCharsetFromHeaders(data.getString("content-type"))))));
|
|
||||||
}
|
|
||||||
|
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user