b/2296110 Car Dock - Stop service when done processing each command. Clean up logs.
Change-Id: I92124d2856e6c825a2b4148473431789a1f5b156
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<!-- Wireless Controls -->
|
<!-- Wireless Controls -->
|
||||||
|
|
||||||
<activity android:name="WirelessSettings"
|
<activity android:name="WirelessSettings"
|
||||||
android:label="@string/wireless_networks_settings_title"
|
android:label="@string/wireless_networks_settings_title"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="LocalePickerInSetupWizard" android:label="@string/language_picker_title">
|
<activity android:name="LocalePickerInSetupWizard" android:label="@string/language_picker_title">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="PhysicalKeyboardSettings"
|
<activity android:name="PhysicalKeyboardSettings"
|
||||||
android:label="@string/builtin_keyboard_settings_title">
|
android:label="@string/builtin_keyboard_settings_title">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -283,7 +283,7 @@
|
|||||||
<category android:name="com.android.settings.SHORTCUT" />
|
<category android:name="com.android.settings.SHORTCUT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="InstalledAppDetails" android:label="@string/application_info_label">
|
<activity android:name="InstalledAppDetails" android:label="@string/application_info_label">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
@@ -303,7 +303,7 @@
|
|||||||
<category android:name="com.android.settings.SHORTCUT" />
|
<category android:name="com.android.settings.SHORTCUT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="SecuritySettings"
|
<activity android:name="SecuritySettings"
|
||||||
android:label="@string/location_security_settings_title"
|
android:label="@string/location_security_settings_title"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
@@ -373,22 +373,22 @@
|
|||||||
<!-- Second and third-level settings -->
|
<!-- Second and third-level settings -->
|
||||||
|
|
||||||
<activity android:name="ConfirmLockPattern"/>
|
<activity android:name="ConfirmLockPattern"/>
|
||||||
|
|
||||||
<activity android:name="ChooseLockPattern" android:label="@string/lockpattern_change_lock_pattern_label">
|
<activity android:name="ChooseLockPattern" android:label="@string/lockpattern_change_lock_pattern_label">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.DEFAULT" />
|
<action android:name="android.intent.action.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="ChooseLockPatternTutorial"
|
<activity android:name="ChooseLockPatternTutorial"
|
||||||
android:label="@string/lockpattern_change_lock_pattern_label"
|
android:label="@string/lockpattern_change_lock_pattern_label"
|
||||||
>
|
>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.DEFAULT" />
|
<action android:name="android.intent.action.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="ChooseLockPatternExample"
|
<activity android:name="ChooseLockPatternExample"
|
||||||
android:label="@string/lockpattern_change_lock_pattern_label">
|
android:label="@string/lockpattern_change_lock_pattern_label">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.DEFAULT" />
|
<action android:name="android.intent.action.DEFAULT" />
|
||||||
@@ -444,7 +444,7 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".quicklaunch.QuickLaunchSettings"
|
<activity android:name=".quicklaunch.QuickLaunchSettings"
|
||||||
android:label="@string/quick_launch_title">
|
android:label="@string/quick_launch_title">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -453,7 +453,7 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".quicklaunch.BookmarkPicker" android:label="@string/quick_launch_title">
|
<activity android:name=".quicklaunch.BookmarkPicker" android:label="@string/quick_launch_title">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@@ -55,7 +55,7 @@ public class DockEventReceiver extends BroadcastReceiver {
|
|||||||
if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())
|
if (Intent.ACTION_DOCK_EVENT.equals(intent.getAction())
|
||||||
|| ACTION_DOCK_SHOW_UI.endsWith(intent.getAction())) {
|
|| ACTION_DOCK_SHOW_UI.endsWith(intent.getAction())) {
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
if (DEBUG) Log.e(TAG, "Device is missing");
|
if (DEBUG) Log.d(TAG, "Device is missing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -46,12 +46,6 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
|
DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
|
||||||
CompoundButton.OnCheckedChangeListener {
|
CompoundButton.OnCheckedChangeListener {
|
||||||
|
|
||||||
// TODO check for waitlock leak
|
|
||||||
// TODO check for service shutting down properly
|
|
||||||
// TODO sticky vs non-sticky
|
|
||||||
// TODO clean up static functions
|
|
||||||
// TODO test after wiping data
|
|
||||||
|
|
||||||
private static final String TAG = "DockService";
|
private static final String TAG = "DockService";
|
||||||
|
|
||||||
// TODO clean up logs. Disable DEBUG flag for this file and receiver's too
|
// TODO clean up logs. Disable DEBUG flag for this file and receiver's too
|
||||||
@@ -157,7 +151,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
msg.arg2 = startId;
|
msg.arg2 = startId;
|
||||||
processMessage(msg);
|
processMessage(msg);
|
||||||
|
|
||||||
return START_STICKY;
|
return START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class ServiceHandler extends Handler {
|
private final class ServiceHandler extends Handler {
|
||||||
@@ -229,15 +223,15 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
case MSG_TYPE_UNDOCKED_TEMPORARY:
|
case MSG_TYPE_UNDOCKED_TEMPORARY:
|
||||||
// Undocked event received. Queue a delayed msg to sever connection
|
// Undocked event received. Queue a delayed msg to sever connection
|
||||||
Message newMsg = mServiceHandler.obtainMessage(MSG_TYPE_UNDOCKED_PERMANENT, state,
|
Message newMsg = mServiceHandler.obtainMessage(MSG_TYPE_UNDOCKED_PERMANENT, state,
|
||||||
0, device);
|
startId, device);
|
||||||
mServiceHandler.sendMessageDelayed(newMsg, UNDOCKED_GRACE_PERIOD);
|
mServiceHandler.sendMessageDelayed(newMsg, UNDOCKED_GRACE_PERIOD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDialog == null && mPendingDevice == null) {
|
if (mDialog == null && mPendingDevice == null && msgType != MSG_TYPE_UNDOCKED_TEMPORARY) {
|
||||||
// NOTE: We MUST not call stopSelf() directly, since we need to
|
// NOTE: We MUST not call stopSelf() directly, since we need to
|
||||||
// make sure the wake lock acquired by the Receiver is released.
|
// make sure the wake lock acquired by the Receiver is released.
|
||||||
DockEventReceiver.finishStartingService(DockService.this, msg.arg1);
|
DockEventReceiver.finishStartingService(DockService.this, startId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +245,7 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
Log.e(TAG, "device is null");
|
Log.w(TAG, "device is null");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,8 +410,9 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
|
|||||||
if (mPendingDevice.equals(mDevice)) {
|
if (mPendingDevice.equals(mDevice)) {
|
||||||
if(DEBUG) Log.d(TAG, "applying settings");
|
if(DEBUG) Log.d(TAG, "applying settings");
|
||||||
applyBtSettings(mPendingDevice, mPendingStartId);
|
applyBtSettings(mPendingDevice, mPendingStartId);
|
||||||
} if(DEBUG) {
|
} else if(DEBUG) {
|
||||||
Log.d(TAG, "mPendingDevice != mDevice");
|
Log.d(TAG, "mPendingDevice (" + mPendingDevice + ") != mDevice ("
|
||||||
|
+ mDevice + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
mPendingDevice = null;
|
mPendingDevice = null;
|
||||||
|
Reference in New Issue
Block a user