lint recommendations

This commit is contained in:
Milos Kozak 2019-07-27 19:56:07 +02:00
parent 1baec16c4b
commit 84ecb92771
40 changed files with 114 additions and 134 deletions

View file

@ -6,8 +6,9 @@ import info.nightscout.androidaps.plugins.aps.loop.APSResult;
* Created by mike on 10.06.2016.
*/
public interface APSInterface {
public APSResult getLastAPSResult();
public long getLastAPSRun();
APSResult getLastAPSResult();
public void invoke(String initiator, boolean tempBasalFallback);
long getLastAPSRun();
void invoke(String initiator, boolean tempBasalFallback);
}

View file

@ -61,6 +61,6 @@ public interface ConstraintsInterface {
default Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
return maxIob;
};
}
}

View file

@ -18,21 +18,30 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
public interface PumpInterface {
boolean isInitialized(); // true if pump status has been read and is ready to accept commands
boolean isSuspended(); // true if suspended (not delivering insulin)
boolean isBusy(); // if true pump is not ready to accept commands right now
boolean isConnected(); // true if BT connection is established
boolean isConnecting(); // true if BT connection is in progress
boolean isHandshakeInProgress(); // true if BT is connected but initial handshake is still in progress
void finishHandshaking(); // set initial handshake completed
void connect(String reason);
void disconnect(String reason);
void stopConnecting();
void getPumpStatus();
// Upload to pump new basal profile
PumpEnactResult setNewBasalProfile(Profile profile);
boolean isThisProfileSet(Profile profile);
long lastDataTime();
@ -44,19 +53,28 @@ public interface PumpInterface {
int getBatteryLevel(); // in percent as integer
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
void stopBolusDelivering();
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew);
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew);
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
//some pumps might set a very short temp close to 100% as cancelling a temp can be noisy
//when the cancel request is requested by the user (forced), the pump should always do a real cancel
PumpEnactResult cancelTempBasal(boolean enforceNew);
PumpEnactResult cancelExtendedBolus();
// Status to be passed to NS
JSONObject getJSONStatus(Profile profile, String profileName);
ManufacturerType manufacturer();
PumpType model();
String serialNumber();
// Pump capabilities
@ -69,7 +87,7 @@ public interface PumpInterface {
PumpEnactResult loadTDDs();
public boolean canHandleDST();
boolean canHandleDST();
List<CustomAction> getCustomActions();

View file

@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
@ -277,7 +278,7 @@ public class DetermineBasalAdapterAMAJS {
private String readFile(String filename) throws IOException {
byte[] bytes = mScriptReader.readFile(filename);
String string = new String(bytes, "UTF-8");
String string = new String(bytes, StandardCharsets.UTF_8);
if (string.startsWith("#!/usr/bin/env node")) {
string = string.substring(20);
}

View file

@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.R;
@ -207,7 +208,7 @@ public class DetermineBasalAdapterMAJS {
private String readFile(String filename) throws IOException {
byte[] bytes = mScriptReader.readFile(filename);
String string = new String(bytes, "UTF-8");
String string = new String(bytes, StandardCharsets.UTF_8);
if (string.startsWith("#!/usr/bin/env node")) {
string = string.substring(20);
}

View file

@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.charset.StandardCharsets;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
@ -340,7 +341,7 @@ public class DetermineBasalAdapterSMBJS {
private String readFile(String filename) throws IOException {
byte[] bytes = mScriptReader.readFile(filename);
String string = new String(bytes, "UTF-8");
String string = new String(bytes, StandardCharsets.UTF_8);
if (string.startsWith("#!/usr/bin/env node")) {
string = string.substring(20);
}

View file

@ -178,7 +178,7 @@ public class MaintenancePlugin extends PluginBase {
* @return
*/
public String constructName() {
return "AndroidAPS_LOG_" + String.valueOf(new Date().getTime()) + LoggerUtils.SUFFIX;
return "AndroidAPS_LOG_" + new Date().getTime() + LoggerUtils.SUFFIX;
}
public void zip(File zipFile, List<File> files) throws IOException {
@ -187,7 +187,7 @@ public class MaintenancePlugin extends PluginBase {
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile)));
for (File file : files) {
byte data[] = new byte[BUFFER_SIZE];
byte[] data = new byte[BUFFER_SIZE];
try(FileInputStream fileInputStream = new FileInputStream( file )) {

View file

@ -21,7 +21,7 @@ public class DismissNotificationService extends IntentService {
public DismissNotificationService(){
super("DismissNotificationService");
};
}
@Override
protected void onHandleIntent(@Nullable Intent intent) {

View file

@ -52,7 +52,7 @@ public class InsulinFragment extends Fragment {
private void updateGUI() {
insulinName.setText(ConfigBuilderPlugin.getPlugin().getActiveInsulin().getFriendlyName());
insulinComment.setText(ConfigBuilderPlugin.getPlugin().getActiveInsulin().getComment());
insulinDia.setText(MainApp.gs(R.string.dia) + " " + Double.toString(ConfigBuilderPlugin.getPlugin().getActiveInsulin().getDia()) + "h");
insulinDia.setText(MainApp.gs(R.string.dia) + " " + ConfigBuilderPlugin.getPlugin().getActiveInsulin().getDia() + "h");
insulinGraph.show(ConfigBuilderPlugin.getPlugin().getActiveInsulin());
}

View file

@ -1,21 +1,20 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.content.Context;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
@ -112,7 +111,7 @@ public class RileyLinkUtil {
private static synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState,
RileyLinkError errorCode, boolean set) {
RileyLinkError errorCode, boolean set) {
if (set) {
@ -121,17 +120,17 @@ public class RileyLinkUtil {
if (L.isEnabled(L.PUMP))
LOG.info("RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: "
+ errorCode.name());
+ errorCode.name());
RileyLinkUtil.historyRileyLink.add(new RLHistoryItem(RileyLinkUtil.rileyLinkServiceData.serviceState,
RileyLinkUtil.rileyLinkServiceData.errorCode, targetDevice));
RileyLinkUtil.rileyLinkServiceData.errorCode, targetDevice));
MainApp.bus().post(new EventMedtronicDeviceStatusChange(newState, errorCode));
return null;
} else {
return (RileyLinkUtil.rileyLinkServiceData == null || RileyLinkUtil.rileyLinkServiceData.serviceState == null) ? //
RileyLinkServiceState.NotStarted
: RileyLinkUtil.rileyLinkServiceData.serviceState;
RileyLinkServiceState.NotStarted
: RileyLinkUtil.rileyLinkServiceData.serviceState;
}
}
@ -259,7 +258,7 @@ public class RileyLinkUtil {
case 0x03: // Complete list of 16-bit UUIDs
while (length >= 2) {
uuids
.add(UUID.fromString(String.format("%08x-0000-1000-8000-00805f9b34fb", buffer.getShort())));
.add(UUID.fromString(String.format("%08x-0000-1000-8000-00805f9b34fb", buffer.getShort())));
length -= 2;
}
break;
@ -275,11 +274,7 @@ public class RileyLinkUtil {
case 0x09:
byte[] nameBytes = new byte[length - 1];
buffer.get(nameBytes);
try {
name = new String(nameBytes, "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
name = new String(nameBytes, StandardCharsets.UTF_8);
break;
default:
buffer.position(buffer.position() + length - 1);

View file

@ -10,6 +10,6 @@ public enum ServiceTransportType {
ServiceNotification, //
ServiceCommand, //
ServiceResult;
ServiceResult
}

View file

@ -305,12 +305,12 @@ public class ByteUtil {
}
public static String getHex(byte abyte0[]) {
public static String getHex(byte[] abyte0) {
return abyte0 != null ? getHex(abyte0, abyte0.length) : null;
}
public static String getString(short abyte0[]) {
public static String getString(short[] abyte0) {
StringBuilder sb = new StringBuilder();
for (short i : abyte0) {
@ -330,7 +330,7 @@ public class ByteUtil {
}
public static String getHex(byte abyte0[], int i) {
public static String getHex(byte[] abyte0, int i) {
StringBuffer stringbuffer = new StringBuffer();
if (abyte0 != null) {
i = Math.min(i, abyte0.length);

View file

@ -13,7 +13,7 @@ import java.util.List;
*/
public class StringUtil {
public static DecimalFormat DecimalFormaters[] = {
public static DecimalFormat[] DecimalFormaters = {
new DecimalFormat("#0"), new DecimalFormat("#0.0"), new DecimalFormat("#0.00"), new DecimalFormat("#0.000")};

View file

@ -27,7 +27,6 @@ public class BLEScanActivity extends AppCompatActivity {
private ListView listView = null;
private ListAdapter mListAdapter = null;
private ArrayList<BluetoothDeviceItem> mDevices = new ArrayList<>();
;
private BluetoothAdapter mBluetoothAdapter = null;
private BluetoothLeScanner mBluetoothLeScanner = null;

View file

@ -47,8 +47,6 @@ public class DanaRS_Packet {
return null;
}
;
// STATIC FUNCTIONS
public static int getCommand(byte[] data) {

View file

@ -853,7 +853,6 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
if (extendedBolus != null) {
extendedBolus.durationInMinutes = (int) ((System.currentTimeMillis() - extendedBolus.date) / 60000);
if (extendedBolus.durationInMinutes <= 0) {
;
final String _id = extendedBolus._id;
if (NSUpload.isIdValid(_id))
NSUpload.removeCareportalEntryFromNS(_id);

View file

@ -3,6 +3,6 @@ package info.nightscout.androidaps.plugins.pump.insight.app_layer.history;
public enum HistoryReadingDirection {
FORWARD,
BACKWARD;
BACKWARD
}

View file

@ -5,5 +5,5 @@ public enum AlertCategory {
REMINDER,
MAINTENANCE,
WARNING,
ERROR;
ERROR
}

View file

@ -3,5 +3,5 @@ package info.nightscout.androidaps.plugins.pump.insight.descriptors;
public enum AlertStatus {
ACTIVE,
SNOOZED;
SNOOZED
}

View file

@ -27,5 +27,5 @@ public enum AlertType {
MAINTENANCE_30,
ERROR_6,
ERROR_10,
ERROR_13;
ERROR_13
}

View file

@ -6,5 +6,5 @@ public enum BasalProfile {
PROFILE_2,
PROFILE_3,
PROFILE_4,
PROFILE_5;
PROFILE_5
}

View file

@ -4,5 +4,5 @@ public enum BatteryType {
ALKALI,
LITHIUM,
NI_MH;
NI_MH
}

View file

@ -4,5 +4,5 @@ public enum BolusType {
STANDARD,
EXTENDED,
MULTIWAVE;
MULTIWAVE
}

View file

@ -3,5 +3,5 @@ package info.nightscout.androidaps.plugins.pump.insight.descriptors;
public enum CartridgeType {
PREFILLED,
SELF_FILLED;
SELF_FILLED
}

View file

@ -4,5 +4,5 @@ public enum MessagePriority {
NORMAL,
HIGHER,
HIGHEST;
HIGHEST
}

View file

@ -4,5 +4,5 @@ public enum OperatingMode {
STARTED,
STOPPED,
PAUSED;
PAUSED
}

View file

@ -4,5 +4,5 @@ public enum SymbolStatus {
FULL,
LOW,
EMPTY;
EMPTY
}

View file

@ -4,5 +4,5 @@ public enum PairingStatus {
CONFIRMED,
REJECTED,
PENDING;
PENDING
}

View file

@ -14,5 +14,5 @@ public enum SatlError {
WRONG_STATE,
INVALID_MESSAGE_TYPE,
INVALID_PAYLOAD_LENGTH,
NONE;
NONE
}

View file

@ -1,8 +1,8 @@
package info.nightscout.androidaps.plugins.pump.insight.utils;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
public class ByteBuf {
@ -45,13 +45,11 @@ public class ByteBuf {
}
public void putBytes(byte b, int count) {
for (int i = 0; i < count; i++) bytes[size++] = b;
}
public byte[] getBytes(int position, int length) {
byte[] copy = new byte[length];
System.arraycopy(bytes, position, copy, 0, length);
@ -68,7 +66,7 @@ public class ByteBuf {
return copy;
}
public byte[] readBytes() {
byte[] readBytes() {
return readBytes(size);
}
@ -82,15 +80,14 @@ public class ByteBuf {
}
public byte[] getBytesLE(int position, int length) {
private byte[] getBytesLE(int position, int length) {
byte[] copy = new byte[length];
for (int i = 0; i < length; i++)
copy[i] = bytes[length - 1 - i + position];
return copy;
}
public byte[] getBytesLE(int length) {
private byte[] getBytesLE(int length) {
return getBytesLE(0, length);
}
@ -100,13 +97,13 @@ public class ByteBuf {
return copy;
}
public void putBytesLE(byte[] bytes, int length) {
private void putBytesLE(byte[] bytes, int length) {
for (int i = 0; i < length; i++)
this.bytes[size + length - 1 - i] = bytes[i];
size += length;
}
public void putBytesLE(byte[] bytes) {
void putBytesLE(byte[] bytes) {
putBytesLE(bytes, bytes.length);
}
@ -116,12 +113,11 @@ public class ByteBuf {
}
public short getUInt8(int position) {
private short getUInt8(int position) {
return (short) (bytes[position] & 0xFF);
}
public short getUInt8() {
private short getUInt8() {
return getUInt8(0);
}
@ -136,13 +132,12 @@ public class ByteBuf {
}
public int getUInt16LE(int position) {
return (bytes[position++] & 0xFF |
(bytes[position] & 0xFF) << 8);
(bytes[position] & 0xFF) << 8);
}
public int getUInt16LE() {
private int getUInt16LE() {
return getUInt16LE(0);
}
@ -158,14 +153,13 @@ public class ByteBuf {
}
public double getUInt16Decimal(int position) {
private double getUInt16Decimal(int position) {
return new BigDecimal(getUInt16LE(position))
.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)
.doubleValue();
}
public double getUInt16Decimal() {
private double getUInt16Decimal() {
return getUInt16Decimal(0);
}
@ -183,14 +177,13 @@ public class ByteBuf {
}
public double getUInt32Decimal100(int position) {
private double getUInt32Decimal100(int position) {
return new BigDecimal(getUInt32LE(position))
.divide(new BigDecimal(100), 2, RoundingMode.HALF_UP)
.doubleValue();
}
public double getUInt32Decimal100() {
private double getUInt32Decimal100() {
return getUInt32Decimal100(0);
}
@ -208,14 +201,13 @@ public class ByteBuf {
}
public double getUInt32Decimal1000(int position) {
private double getUInt32Decimal1000(int position) {
return new BigDecimal(getUInt32LE(position))
.divide(new BigDecimal(1000), 3, RoundingMode.HALF_UP)
.doubleValue();
}
public double getUInt32Decimal1000() {
private double getUInt32Decimal1000() {
return getUInt32Decimal1000(0);
}
@ -233,9 +225,8 @@ public class ByteBuf {
}
public short getShort(int position) {
return (short) (bytes[position++] << 8 |
private short getShort(int position) {
return (short) (bytes[position++] << 8 |
bytes[position] & 0xFF);
}
@ -255,15 +246,14 @@ public class ByteBuf {
}
public long getUInt32LE(int position) {
private long getUInt32LE(int position) {
return ((long) bytes[position++] & 0xFF) |
((long) bytes[position++] & 0xFF) << 8 |
((long) bytes[position++] & 0xFF) << 16 |
((long) bytes[position] & 0xFF) << 24;
}
public long getUInt32LE() {
private long getUInt32LE() {
return getUInt32LE(0);
}
@ -281,18 +271,12 @@ public class ByteBuf {
}
public String getUTF16(int position, int stringLength) {
try {
String string = new String(getBytes(position, stringLength * 2 + 2), "UTF-16LE");
return string.substring(0, string.indexOf(new String(new char[] {0, 0})));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
private String getUTF16(int position, int stringLength) {
String string = new String(getBytes(position, stringLength * 2 + 2), StandardCharsets.UTF_16LE);
return string.substring(0, string.indexOf(new String(new char[]{0, 0})));
}
public String getUTF16(int stringLength) {
private String getUTF16(int stringLength) {
return getUTF16(0, stringLength);
}
@ -303,27 +287,17 @@ public class ByteBuf {
}
public void putUTF16(String string, int stringLength) {
try {
putBytes(string.getBytes("UTF-16LE"), stringLength * 2);
putBytes((byte) 0, 2);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
putBytes(string.getBytes(StandardCharsets.UTF_16LE), stringLength * 2);
putBytes((byte) 0, 2);
}
public String getASCII(int position, int stringLength) {
try {
String string = new String(getBytes(position, stringLength + 1), "US-ASCII");
return string.substring(0, string.indexOf(0));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
private String getASCII(int position, int stringLength) {
String string = new String(getBytes(position, stringLength + 1), StandardCharsets.US_ASCII);
return string.substring(0, string.indexOf(0));
}
public String getASCII(int stringLength) {
private String getASCII(int stringLength) {
return getASCII(0, stringLength);
}
@ -334,16 +308,11 @@ public class ByteBuf {
}
public void putASCII(String string, int stringLength) {
try {
putBytes(string.getBytes("UTF-16LE"), stringLength * 2);
putBytes((byte) 0, 1);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
putBytes(string.getBytes(StandardCharsets.UTF_16LE), stringLength * 2);
putBytes((byte) 0, 1);
}
public boolean getBoolean(int position) {
return getUInt16LE(position) == 75;
}
@ -363,7 +332,6 @@ public class ByteBuf {
}
public static ByteBuf from(byte[] bytes, int length) {
ByteBuf byteBuf = new ByteBuf(length);
byteBuf.putBytes(bytes, length);

View file

@ -412,7 +412,7 @@ public class MedtronicConverter {
}
public double decodeMaxBolus(byte ai[]) {
public double decodeMaxBolus(byte[] ai) {
return is523orHigher() ? decodeBolusInsulin(ByteUtil.toInt(ai[5], ai[6])) : decodeBolusInsulin(ByteUtil
.asUINT8(ai[5]));
}

View file

@ -30,9 +30,9 @@ public enum CGMSHistoryEntryType {
SensorCalFactor(0x0f, "SensorCalFactor", 1, 4, 2, DateType.MinuteSpecific), //
Something10(0x10, "10-Something", 1, 4, 0, DateType.MinuteSpecific), //
Something19(0x13, "19-Something", 1, 0, 0, DateType.PreviousTimeStamp),
GlucoseSensorData(0xFF, "GlucoseSensorData", 1, 0, 0, DateType.PreviousTimeStamp);;
GlucoseSensorData(0xFF, "GlucoseSensorData", 1, 0, 0, DateType.PreviousTimeStamp);
private static Map<Integer, CGMSHistoryEntryType> opCodeMap = new HashMap<Integer, CGMSHistoryEntryType>();
private static Map<Integer, CGMSHistoryEntryType> opCodeMap = new HashMap<>();
static {
for (CGMSHistoryEntryType type : values()) {
@ -40,7 +40,7 @@ public enum CGMSHistoryEntryType {
}
}
public boolean schemaSet = false;
public boolean schemaSet;
private int opCode;
private String description;
private int headLength;
@ -129,7 +129,6 @@ public enum CGMSHistoryEntryType {
MinuteSpecific, //
SecondSpecific, //
PreviousTimeStamp //
;
}

View file

@ -217,7 +217,7 @@ public class MedtronicCGMSHistoryDecoder extends MedtronicHistoryDecoder<CGMSHis
}
private <E extends Object> List<E> reverseList(List<E> dataClearInput, Class<E> clazz) {
private <E> List<E> reverseList(List<E> dataClearInput, Class<E> clazz) {
List<E> outList = new ArrayList<E>();
@ -263,7 +263,7 @@ public class MedtronicCGMSHistoryDecoder extends MedtronicHistoryDecoder<CGMSHis
if (!entry.getEntryType().hasDate())
return null;
byte data[] = entry.getDatetime();
byte[] data = entry.getDatetime();
if (entry.getEntryType().getDateType() == CGMSHistoryEntryType.DateType.MinuteSpecific) {

View file

@ -120,7 +120,7 @@ public class DailyTotalsDTO {
// Daily
byte body[] = data; // entry.getBody();
byte[] body = data; // entry.getBody();
//System.out.println("Totals 522");
for (int i = 0; i < body.length - 2; i++) {

View file

@ -21,7 +21,7 @@ public class TempBasalProcessDTO {
}
public static enum Operation {
public enum Operation {
None,
Add,
Edit

View file

@ -8,6 +8,6 @@ public enum MedtronicUIResponseType {
Data,
Error,
Invalid;
Invalid
}

View file

@ -17,7 +17,7 @@ public class JsonHelper {
private static final Logger log = LoggerFactory.getLogger(JsonHelper.class);
private JsonHelper() {};
private JsonHelper() {}
public static Object safeGetObject(JSONObject json, String fieldName, Object defaultValue) {
Object result = defaultValue;

View file

@ -44,7 +44,7 @@ public class ComposeTriggerTest {
public void testChangeConnector() {
// initialize scenario
TriggerConnector root = new TriggerConnector(TriggerConnector.Type.AND);
Trigger t[] = new Trigger[4];
Trigger[] t = new Trigger[4];
for (int i = 0; i < t.length; ++i) {
t[i] = new DummyTrigger();
root.add(t[i]);

View file

@ -32,7 +32,7 @@ public class ActionTest extends Action {
@Override
public Optional<Integer> icon() {
return null;
return Optional.absent();
}
@Test

View file

@ -585,7 +585,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
private void showBolusProgress(int progresspercent, String progresstatus) {
Intent cancelIntent = new Intent(this, ListenerService.class);
cancelIntent.setAction(ACTION_CANCELBOLUS);
PendingIntent cancelPendingIntent = PendingIntent.getService(this, 0, cancelIntent, 0);;
PendingIntent cancelPendingIntent = PendingIntent.getService(this, 0, cancelIntent, 0);
long[] vibratePattern;
boolean vibreate = PreferenceManager