Loading services/core/java/com/android/server/media/MediaSessionService.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ import java.util.NoSuchElementException; */ */ public class MediaSessionService extends SystemService implements Monitor { public class MediaSessionService extends SystemService implements Monitor { private static final String TAG = "MediaSessionService"; private static final String TAG = "MediaSessionService"; static final boolean USE_MEDIA2_APIS = false; // TODO: Change this to true when we're ready. static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); // Leave log for key event always. // Leave log for key event always. private static final boolean DEBUG_KEY_EVENT = true; private static final boolean DEBUG_KEY_EVENT = true; Loading Loading @@ -508,6 +509,9 @@ public class MediaSessionService extends SystemService implements Monitor { } } private void buildMediaSessionService2List() { private void buildMediaSessionService2List() { if (!USE_MEDIA2_APIS) { return; } if (DEBUG) { if (DEBUG) { Log.d(TAG, "buildMediaSessionService2List"); Log.d(TAG, "buildMediaSessionService2List"); } } Loading Loading @@ -1531,6 +1535,9 @@ public class MediaSessionService extends SystemService implements Monitor { */ */ @Override @Override public boolean createSession2(Bundle sessionToken) { public boolean createSession2(Bundle sessionToken) { if (!USE_MEDIA2_APIS) { return false; } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); if (token == null || token.getUid() != uid) { if (token == null || token.getUid() != uid) { Loading Loading @@ -1570,6 +1577,9 @@ public class MediaSessionService extends SystemService implements Monitor { */ */ @Override @Override public void destroySession2(Bundle sessionToken) { public void destroySession2(Bundle sessionToken) { if (!USE_MEDIA2_APIS) { return; } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); if (token == null || token.getUid() != uid) { if (token == null || token.getUid() != uid) { Loading @@ -1586,6 +1596,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public List<Bundle> getSessionTokens(boolean activeSessionOnly, public List<Bundle> getSessionTokens(boolean activeSessionOnly, boolean sessionServiceOnly, String packageName) throws RemoteException { boolean sessionServiceOnly, String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return null; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading Loading @@ -1614,6 +1627,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public void addSessionTokensListener(ISessionTokensListener listener, int userId, public void addSessionTokensListener(ISessionTokensListener listener, int userId, String packageName) throws RemoteException { String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading @@ -1637,6 +1653,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public void removeSessionTokensListener(ISessionTokensListener listener, public void removeSessionTokensListener(ISessionTokensListener listener, String packageName) throws RemoteException { String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading Loading
services/core/java/com/android/server/media/MediaSessionService.java +19 −0 Original line number Original line Diff line number Diff line Loading @@ -101,6 +101,7 @@ import java.util.NoSuchElementException; */ */ public class MediaSessionService extends SystemService implements Monitor { public class MediaSessionService extends SystemService implements Monitor { private static final String TAG = "MediaSessionService"; private static final String TAG = "MediaSessionService"; static final boolean USE_MEDIA2_APIS = false; // TODO: Change this to true when we're ready. static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); // Leave log for key event always. // Leave log for key event always. private static final boolean DEBUG_KEY_EVENT = true; private static final boolean DEBUG_KEY_EVENT = true; Loading Loading @@ -508,6 +509,9 @@ public class MediaSessionService extends SystemService implements Monitor { } } private void buildMediaSessionService2List() { private void buildMediaSessionService2List() { if (!USE_MEDIA2_APIS) { return; } if (DEBUG) { if (DEBUG) { Log.d(TAG, "buildMediaSessionService2List"); Log.d(TAG, "buildMediaSessionService2List"); } } Loading Loading @@ -1531,6 +1535,9 @@ public class MediaSessionService extends SystemService implements Monitor { */ */ @Override @Override public boolean createSession2(Bundle sessionToken) { public boolean createSession2(Bundle sessionToken) { if (!USE_MEDIA2_APIS) { return false; } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); if (token == null || token.getUid() != uid) { if (token == null || token.getUid() != uid) { Loading Loading @@ -1570,6 +1577,9 @@ public class MediaSessionService extends SystemService implements Monitor { */ */ @Override @Override public void destroySession2(Bundle sessionToken) { public void destroySession2(Bundle sessionToken) { if (!USE_MEDIA2_APIS) { return; } final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); final SessionToken2 token = SessionToken2.fromBundle(sessionToken); if (token == null || token.getUid() != uid) { if (token == null || token.getUid() != uid) { Loading @@ -1586,6 +1596,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public List<Bundle> getSessionTokens(boolean activeSessionOnly, public List<Bundle> getSessionTokens(boolean activeSessionOnly, boolean sessionServiceOnly, String packageName) throws RemoteException { boolean sessionServiceOnly, String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return null; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading Loading @@ -1614,6 +1627,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public void addSessionTokensListener(ISessionTokensListener listener, int userId, public void addSessionTokensListener(ISessionTokensListener listener, int userId, String packageName) throws RemoteException { String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading @@ -1637,6 +1653,9 @@ public class MediaSessionService extends SystemService implements Monitor { @Override @Override public void removeSessionTokensListener(ISessionTokensListener listener, public void removeSessionTokensListener(ISessionTokensListener listener, String packageName) throws RemoteException { String packageName) throws RemoteException { if (!USE_MEDIA2_APIS) { return; } final int pid = Binder.getCallingPid(); final int pid = Binder.getCallingPid(); final int uid = Binder.getCallingUid(); final int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); final long token = Binder.clearCallingIdentity(); Loading