diff options
author | Keith Mok <kmok@cyngn.com> | 2016-05-04 08:54:17 -0700 |
---|---|---|
committer | Keith Mok <kmok@cyngn.com> | 2016-05-04 09:01:06 -0700 |
commit | 9bec890de772f20efd605c0a4fa77fbe4f7ef5ec (patch) | |
tree | 488d841707a67357666c29ce6b8f2e96d3975ff0 | |
parent | f88548ae260b66af3a77e024c08d1b05f2c4812c (diff) | |
download | android_packages_apps_Screencast-9bec890de772f20efd605c0a4fa77fbe4f7ef5ec.tar.gz android_packages_apps_Screencast-9bec890de772f20efd605c0a4fa77fbe4f7ef5ec.tar.bz2 android_packages_apps_Screencast-9bec890de772f20efd605c0a4fa77fbe4f7ef5ec.zip |
Screencast: Fix screencast video cannot playback
Fix cannot play the screencast video after reboot the device.
stopRecorder is not called when system reboot/shutdown while
screencast is still recording in the background services,
since onDestory in Service does not get called in this case.
Add a ACTION_SHUTDOWN intent to listen to this event and handling
this gratefully.
FEIJ-404
Change-Id: If26f568841eb681e5e30a00a68de2fbe9adacc4a
-rw-r--r-- | src/org/cyanogenmod/screencast/ScreencastService.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/cyanogenmod/screencast/ScreencastService.java b/src/org/cyanogenmod/screencast/ScreencastService.java index 1f37ac3..0bbc382 100644 --- a/src/org/cyanogenmod/screencast/ScreencastService.java +++ b/src/org/cyanogenmod/screencast/ScreencastService.java @@ -62,10 +62,11 @@ public class ScreencastService extends Service { private static final String SHOW_TOUCHES = "show_touches"; - private BroadcastReceiver mUserSwitchReceiver = new BroadcastReceiver() { + private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(Intent.ACTION_USER_BACKGROUND)) { + if (intent.getAction().equals(Intent.ACTION_USER_BACKGROUND) || + intent.getAction().equals(Intent.ACTION_SHUTDOWN)) { context.startService(new Intent(ACTION_STOP_SCREENCAST) .setClass(context, ScreencastService.class)); } @@ -99,14 +100,15 @@ public class ScreencastService extends Service { stopCasting(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_USER_BACKGROUND); - registerReceiver(mUserSwitchReceiver, filter); + filter.addAction(Intent.ACTION_SHUTDOWN); + registerReceiver(mBroadcastReceiver, filter); super.onCreate(); } @Override public void onDestroy() { stopCasting(); - unregisterReceiver(mUserSwitchReceiver); + unregisterReceiver(mBroadcastReceiver); super.onDestroy(); } |