Create BootReceiver for Exchange for proper self-management
Change-Id: I95e9e632de91d7f0e2505bf8879e1c164861f58c
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4423c69..734d050 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -161,6 +161,12 @@
</activity>
<receiver android:name="com.android.exchange.EmailSyncAlarmReceiver"/>
<receiver android:name="com.android.exchange.MailboxAlarmReceiver"/>
+ <receiver android:name="com.android.exchange.BootReceiver" android:enabled="true">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ </intent-filter>
+ </receiver>
+
<receiver android:name=".service.BootReceiver"
android:enabled="false"
>
@@ -174,6 +180,7 @@
<action android:name="android.intent.action.DEVICE_STORAGE_OK" />
</intent-filter>
</receiver>
+
<service
android:name=".service.MailService"
android:enabled="false"
diff --git a/src/com/android/exchange/BootReceiver.java b/src/com/android/exchange/BootReceiver.java
new file mode 100644
index 0000000..5312bfb
--- /dev/null
+++ b/src/com/android/exchange/BootReceiver.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.exchange;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+public class BootReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d("Exchange", "BootReceiver onReceive");
+ context.startService(new Intent(context, SyncManager.class));
+ }
+}
diff --git a/src/com/android/exchange/SyncManager.java b/src/com/android/exchange/SyncManager.java
index a226e2e..4b861ba 100644
--- a/src/com/android/exchange/SyncManager.java
+++ b/src/com/android/exchange/SyncManager.java
@@ -655,6 +655,7 @@
if (INSTANCE != null) {
Log.d(TAG, "onCreate called on running SyncManager");
} else {
+ Log.d(TAG, "!!! EAS SyncManager started");
INSTANCE = this;
try {
sDeviceId = getDeviceId();
@@ -676,7 +677,7 @@
@Override
public void onDestroy() {
- log("!!! SyncManager onDestroy");
+ log("!!! EAS SyncManager destroyed");
}
void maybeStartSyncManagerThread() {