}
- public PowerManager.WakeLock getLocationWakeLock() {
- PowerManager.WakeLock wakeLock = ((PowerManager) (runtime.getContextProxy())
- .context.getSystemService(Context.POWER_SERVICE)).newWakeLock(
- PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getSimpleName());
- wakeLock.acquire(1000L);
- return wakeLock;
- }
-
public void onAlarm(PowerManager.WakeLock paramWakeLock) {
//每分钟更新一次数据
runtime.preCellInfo = runtime.getCurrentCellInfo();
import static android.telephony.TelephonyManager.CALL_STATE_RINGING;
import static com.enqualcomm.support.Constants.ACTION_ALARM_ALARM_CHANGE;
import static com.enqualcomm.support.Constants.ACTION_ALARM_DELETE_ALARM;
+import static com.enqualcomm.support.Constants.ACTION_ALARM_DELETE_ALARM_RESULT;
import static com.enqualcomm.support.Constants.ACTION_ANTIOFF_ALARM_CHANGE;
import static com.enqualcomm.support.Constants.ACTION_CLOSE_UNREAD_MSG;
import static com.enqualcomm.support.Constants.ACTION_IC_ALARM;
int delete = context.getContentResolver().delete(Uri.parse(ICAlarmProvider.ALARMS),
"_id=?", new String[]{alarmId});
ICLogger.d("delete alarm ==|||=> " + delete);
+ //通知UI更新
+ mContext.sendBroadcast(new Intent(ACTION_ALARM_DELETE_ALARM_RESULT));
}
query.close();
}
import android.content.Context;\r
import android.os.Handler;\r
import android.os.HandlerThread;\r
+import android.os.PowerManager;\r
import android.os.Vibrator;\r
\r
import static android.content.Context.VIBRATOR_SERVICE;\r
public class VibrateUtil {\r
\r
private final Handler handler;\r
+ private PowerManager.WakeLock locationWakeLock;\r
\r
private VibrateUtil(Context context) {\r
if (mContext == null) {\r
handler = new Handler(handlerThread.getLooper());\r
}\r
\r
- private static Context mContext = null;\r
+ private Context mContext = null;\r
\r
public static VibrateUtil getInstance(Context context) {\r
if (vibrateUtil == null) {\r
isVibrate = false;\r
vibrator.cancel();\r
ICLogger.d("vibrate finish...");\r
- }, 1300);\r
+ locationWakeLock.release();\r
+ ICLogger.d("acquire wake lock...");\r
+ }, 2000);\r
handler.removeCallbacks(vibrateTask);\r
handler.post(vibrateTask);\r
} else {\r
}\r
}\r
\r
+ public PowerManager.WakeLock getLocationWakeLock() {\r
+ PowerManager.WakeLock wakeLock = ((PowerManager) mContext.getSystemService(Context.POWER_SERVICE))\r
+ .newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, this.getClass().getSimpleName());\r
+ wakeLock.acquire(3000L);\r
+ ICLogger.d("acquire wake lock...");\r
+ return wakeLock;\r
+ }\r
+\r
private final Runnable vibrateTask = () -> {\r
+ locationWakeLock = getLocationWakeLock();\r
vibrator.vibrate(1000);//不循环\r
};\r
\r