summaryrefslogtreecommitdiff
path: root/core/java/android/app/ApplicationThreadNative.java
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2014-06-27 12:10:03 -0700
committerCraig Mautner <cmautner@google.com>2014-07-08 06:24:53 -0700
commitee2e45acbff28986c2ced636b7550d0afbb0eeb7 (patch)
tree9886ab894004e2b29b5075c6af9af070a21d68de /core/java/android/app/ApplicationThreadNative.java
parent4143bc5f09a0ff73ca92caf3b2012c0ffd780555 (diff)
Add Media Playing API
These methods permit an activity to play or continue playing media behind a translucent activity above it. Particularly the home activity in Android TV. Methods exist to notify the upper activity when playing starts or stops and for notifying the playing activity when to stop playing and release its resources. Methods are called when either activity's state changes or new activities are launched. Fixes bug 14469711. Change-Id: I7ba10c5a4683504931cffa228488f5281e5bbf86
Diffstat (limited to 'core/java/android/app/ApplicationThreadNative.java')
-rw-r--r--core/java/android/app/ApplicationThreadNative.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index 6dead08d2a8b..0b4510fe4c7e 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -647,6 +647,25 @@ public abstract class ApplicationThreadNative extends Binder
reply.writeNoException();
return true;
}
+
+ case STOP_MEDIA_PLAYING_TRANSACTION:
+ {
+ data.enforceInterface(IApplicationThread.descriptor);
+ IBinder token = data.readStrongBinder();
+ scheduleStopMediaPlaying(token);
+ reply.writeNoException();
+ return true;
+ }
+
+ case BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION:
+ {
+ data.enforceInterface(IApplicationThread.descriptor);
+ IBinder token = data.readStrongBinder();
+ boolean enabled = data.readInt() > 0;
+ scheduleBackgroundMediaPlayingChanged(token, enabled);
+ reply.writeNoException();
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -1304,4 +1323,23 @@ class ApplicationThreadProxy implements IApplicationThread {
mRemote.transact(UPDATE_TIME_PREFS_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
data.recycle();
}
+
+ @Override
+ public void scheduleStopMediaPlaying(IBinder token) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ data.writeInterfaceToken(IApplicationThread.descriptor);
+ data.writeStrongBinder(token);
+ mRemote.transact(STOP_MEDIA_PLAYING_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
+ data.recycle();
+ }
+
+ @Override
+ public void scheduleBackgroundMediaPlayingChanged(IBinder token, boolean enabled) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ data.writeInterfaceToken(IApplicationThread.descriptor);
+ data.writeStrongBinder(token);
+ data.writeInt(enabled ? 1 : 0);
+ mRemote.transact(BACKGROUND_MEDIA_PLAYING_CHANGED_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
+ data.recycle();
+ }
}