Loading core/res/AndroidManifest.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -2107,6 +2107,13 @@ android:description="@string/permdesc_captureSecureVideoOutput" android:description="@string/permdesc_captureSecureVideoOutput" android:protectionLevel="signature|system" /> android:protectionLevel="signature|system" /> <!--@hide Allows an application to know what content is playing and control its playback. <p>Not for use by third-party applications due to privacy of media consumption</p> --> <permission android:name="android.permission.MEDIA_CONTENT_CONTROL" android:label="@string/permlab_mediaContentControl" android:description="@string/permdesc_mediaContentControl" android:protectionLevel="signature|system" /> <!-- Required to be able to disable the device (very dangerous!). <!-- Required to be able to disable the device (very dangerous!). <p>Not for use by third-party applications.. --> <p>Not for use by third-party applications.. --> <permission android:name="android.permission.BRICK" <permission android:name="android.permission.BRICK" Loading core/res/res/values/strings.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1432,6 +1432,11 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureSecureVideoOutput">Allows the app to capture and redirect secure video output.</string> <string name="permdesc_captureSecureVideoOutput">Allows the app to capture and redirect secure video output.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_mediaContentControl">control media playback and metadata access</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_mediaContentControl">Allows the app to control media playback and access the media information (title, author...).</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_modifyAudioSettings">change your audio settings</string> <string name="permlab_modifyAudioSettings">change your audio settings</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading media/java/android/media/AudioManager.java +60 −4 Original line number Original line Diff line number Diff line Loading @@ -442,6 +442,19 @@ public class AudioManager { return sService; return sService; } } /** * @hide * @param KeyEvent */ protected void dispatchMediaKeyEvent(KeyEvent keyEvent) { IAudioService service = getService(); try { service.dispatchMediaKeyEvent(keyEvent); } catch (RemoteException e) { Log.e(TAG, "dispatchMediaKeyEvent threw exception ", e); } } /** /** * @hide * @hide */ */ Loading Loading @@ -2233,6 +2246,49 @@ public class AudioManager { } } } } /** * @hide * CANDIDATE FOR PUBLIC API * @param rctlr * @return true if the {@link RemoteController} was successfully registered, false if an * error occurred, due to an internal system error, or insufficient permissions. */ public boolean registerRemoteController(RemoteController rctlr) { if (rctlr == null) { return false; } IAudioService service = getService(); try { boolean reg = service.registerRemoteControlDisplay(rctlr.getRcDisplay(), // passing a negative value for art work width and height // as they are still unknown at this stage /*w*/-1, /*h*/ -1); rctlr.setIsRegistered(reg); return reg; } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); return false; } } /** * @hide * CANDIDATE FOR PUBLIC API * @param rctlr */ public void unregisterRemoteController(RemoteController rctlr) { if (rctlr == null) { return; } IAudioService service = getService(); try { service.unregisterRemoteControlDisplay(rctlr.getRcDisplay()); rctlr.setIsRegistered(false); } catch (RemoteException e) { Log.e(TAG, "Dead object in unregisterRemoteControlDisplay " + e); } } /** /** * @hide * @hide * Registers a remote control display that will be sent information by remote control clients. * Registers a remote control display that will be sent information by remote control clients. Loading Loading @@ -2263,8 +2319,6 @@ public class AudioManager { } } IAudioService service = getService(); IAudioService service = getService(); try { try { // passing a negative value for art work width and height as they are unknown at // this stage service.registerRemoteControlDisplay(rcd, w, h); service.registerRemoteControlDisplay(rcd, w, h); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); Loading Loading @@ -2357,13 +2411,15 @@ public class AudioManager { /** /** * @hide * @hide * Notify the user of a RemoteControlClient that it should update its metadata * Notify the user of a RemoteControlClient that it should update its metadata with the * new value for the given key. * @param generationId the RemoteControlClient generation counter for which this request is * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param key the metadata key for which a new value exists * @param value the new metadata value * @param value the new metadata value */ */ public void updateRemoteControlClientMetadata(int generationId, int key, long value) { public void updateRemoteControlClientMetadata(int generationId, int key, Rating value) { IAudioService service = getService(); IAudioService service = getService(); try { try { service.updateRemoteControlClientMetadata(generationId, key, value); service.updateRemoteControlClientMetadata(generationId, key, value); Loading media/java/android/media/AudioService.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -4143,8 +4143,17 @@ public class AudioService extends IAudioService.Stub { //========================================================================================== //========================================================================================== // RemoteControlDisplay / RemoteControlClient / Remote info // RemoteControlDisplay / RemoteControlClient / Remote info //========================================================================================== //========================================================================================== public void registerRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h) { public boolean registerRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h) { if (PackageManager.PERMISSION_GRANTED == mContext.checkCallingOrSelfPermission( android.Manifest.permission.MEDIA_CONTENT_CONTROL)) { mMediaFocusControl.registerRemoteControlDisplay(rcd, w, h); mMediaFocusControl.registerRemoteControlDisplay(rcd, w, h); return true; } else { Log.w(TAG, "Access denied to process: " + Binder.getCallingPid() + ", must have permission " + android.Manifest.permission.MEDIA_CONTENT_CONTROL + " to register IRemoteControlDisplay"); return false; } } } public void unregisterRemoteControlDisplay(IRemoteControlDisplay rcd) { public void unregisterRemoteControlDisplay(IRemoteControlDisplay rcd) { Loading Loading @@ -4190,7 +4199,7 @@ public class AudioService extends IAudioService.Stub { mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); } } public void updateRemoteControlClientMetadata(int generationId, int key, long value) { public void updateRemoteControlClientMetadata(int generationId, int key, Rating value) { mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); } } Loading media/java/android/media/IAudioService.aidl +5 −3 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.media.IRemoteControlClient; import android.media.IRemoteControlDisplay; import android.media.IRemoteControlDisplay; import android.media.IRemoteVolumeObserver; import android.media.IRemoteVolumeObserver; import android.media.IRingtonePlayer; import android.media.IRingtonePlayer; import android.media.Rating; import android.net.Uri; import android.net.Uri; import android.view.KeyEvent; import android.view.KeyEvent; Loading Loading @@ -140,7 +141,7 @@ interface IAudioService { * @param h the maximum height of the expected bitmap. Negative or zero values indicate this * @param h the maximum height of the expected bitmap. Negative or zero values indicate this * display doesn't need to receive artwork. * display doesn't need to receive artwork. */ */ oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h); boolean registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h); /** /** * Unregister an IRemoteControlDisplay. * Unregister an IRemoteControlDisplay. * No effect if the IRemoteControlDisplay hasn't been successfully registered. * No effect if the IRemoteControlDisplay hasn't been successfully registered. Loading Loading @@ -178,13 +179,14 @@ interface IAudioService { */ */ void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); /** /** * Notify the user of a RemoteControlClient that it should update its metadata * Notify the user of a RemoteControlClient that it should update its metadata with the * new value for the given key. * @param generationId the RemoteControlClient generation counter for which this request is * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param key the metadata key for which a new value exists * @param value the new metadata value * @param value the new metadata value */ */ void updateRemoteControlClientMetadata(int generationId, int key, long value); void updateRemoteControlClientMetadata(int generationId, int key, in Rating value); /** /** * Do not use directly, use instead * Do not use directly, use instead Loading Loading
core/res/AndroidManifest.xml +7 −0 Original line number Original line Diff line number Diff line Loading @@ -2107,6 +2107,13 @@ android:description="@string/permdesc_captureSecureVideoOutput" android:description="@string/permdesc_captureSecureVideoOutput" android:protectionLevel="signature|system" /> android:protectionLevel="signature|system" /> <!--@hide Allows an application to know what content is playing and control its playback. <p>Not for use by third-party applications due to privacy of media consumption</p> --> <permission android:name="android.permission.MEDIA_CONTENT_CONTROL" android:label="@string/permlab_mediaContentControl" android:description="@string/permdesc_mediaContentControl" android:protectionLevel="signature|system" /> <!-- Required to be able to disable the device (very dangerous!). <!-- Required to be able to disable the device (very dangerous!). <p>Not for use by third-party applications.. --> <p>Not for use by third-party applications.. --> <permission android:name="android.permission.BRICK" <permission android:name="android.permission.BRICK" Loading
core/res/res/values/strings.xml +5 −0 Original line number Original line Diff line number Diff line Loading @@ -1432,6 +1432,11 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_captureSecureVideoOutput">Allows the app to capture and redirect secure video output.</string> <string name="permdesc_captureSecureVideoOutput">Allows the app to capture and redirect secure video output.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_mediaContentControl">control media playback and metadata access</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_mediaContentControl">Allows the app to control media playback and access the media information (title, author...).</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_modifyAudioSettings">change your audio settings</string> <string name="permlab_modifyAudioSettings">change your audio settings</string> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> Loading
media/java/android/media/AudioManager.java +60 −4 Original line number Original line Diff line number Diff line Loading @@ -442,6 +442,19 @@ public class AudioManager { return sService; return sService; } } /** * @hide * @param KeyEvent */ protected void dispatchMediaKeyEvent(KeyEvent keyEvent) { IAudioService service = getService(); try { service.dispatchMediaKeyEvent(keyEvent); } catch (RemoteException e) { Log.e(TAG, "dispatchMediaKeyEvent threw exception ", e); } } /** /** * @hide * @hide */ */ Loading Loading @@ -2233,6 +2246,49 @@ public class AudioManager { } } } } /** * @hide * CANDIDATE FOR PUBLIC API * @param rctlr * @return true if the {@link RemoteController} was successfully registered, false if an * error occurred, due to an internal system error, or insufficient permissions. */ public boolean registerRemoteController(RemoteController rctlr) { if (rctlr == null) { return false; } IAudioService service = getService(); try { boolean reg = service.registerRemoteControlDisplay(rctlr.getRcDisplay(), // passing a negative value for art work width and height // as they are still unknown at this stage /*w*/-1, /*h*/ -1); rctlr.setIsRegistered(reg); return reg; } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); return false; } } /** * @hide * CANDIDATE FOR PUBLIC API * @param rctlr */ public void unregisterRemoteController(RemoteController rctlr) { if (rctlr == null) { return; } IAudioService service = getService(); try { service.unregisterRemoteControlDisplay(rctlr.getRcDisplay()); rctlr.setIsRegistered(false); } catch (RemoteException e) { Log.e(TAG, "Dead object in unregisterRemoteControlDisplay " + e); } } /** /** * @hide * @hide * Registers a remote control display that will be sent information by remote control clients. * Registers a remote control display that will be sent information by remote control clients. Loading Loading @@ -2263,8 +2319,6 @@ public class AudioManager { } } IAudioService service = getService(); IAudioService service = getService(); try { try { // passing a negative value for art work width and height as they are unknown at // this stage service.registerRemoteControlDisplay(rcd, w, h); service.registerRemoteControlDisplay(rcd, w, h); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); Log.e(TAG, "Dead object in registerRemoteControlDisplay " + e); Loading Loading @@ -2357,13 +2411,15 @@ public class AudioManager { /** /** * @hide * @hide * Notify the user of a RemoteControlClient that it should update its metadata * Notify the user of a RemoteControlClient that it should update its metadata with the * new value for the given key. * @param generationId the RemoteControlClient generation counter for which this request is * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param key the metadata key for which a new value exists * @param value the new metadata value * @param value the new metadata value */ */ public void updateRemoteControlClientMetadata(int generationId, int key, long value) { public void updateRemoteControlClientMetadata(int generationId, int key, Rating value) { IAudioService service = getService(); IAudioService service = getService(); try { try { service.updateRemoteControlClientMetadata(generationId, key, value); service.updateRemoteControlClientMetadata(generationId, key, value); Loading
media/java/android/media/AudioService.java +12 −3 Original line number Original line Diff line number Diff line Loading @@ -4143,8 +4143,17 @@ public class AudioService extends IAudioService.Stub { //========================================================================================== //========================================================================================== // RemoteControlDisplay / RemoteControlClient / Remote info // RemoteControlDisplay / RemoteControlClient / Remote info //========================================================================================== //========================================================================================== public void registerRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h) { public boolean registerRemoteControlDisplay(IRemoteControlDisplay rcd, int w, int h) { if (PackageManager.PERMISSION_GRANTED == mContext.checkCallingOrSelfPermission( android.Manifest.permission.MEDIA_CONTENT_CONTROL)) { mMediaFocusControl.registerRemoteControlDisplay(rcd, w, h); mMediaFocusControl.registerRemoteControlDisplay(rcd, w, h); return true; } else { Log.w(TAG, "Access denied to process: " + Binder.getCallingPid() + ", must have permission " + android.Manifest.permission.MEDIA_CONTENT_CONTROL + " to register IRemoteControlDisplay"); return false; } } } public void unregisterRemoteControlDisplay(IRemoteControlDisplay rcd) { public void unregisterRemoteControlDisplay(IRemoteControlDisplay rcd) { Loading Loading @@ -4190,7 +4199,7 @@ public class AudioService extends IAudioService.Stub { mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); mMediaFocusControl.setRemoteControlClientPlaybackPosition(generationId, timeMs); } } public void updateRemoteControlClientMetadata(int generationId, int key, long value) { public void updateRemoteControlClientMetadata(int generationId, int key, Rating value) { mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); mMediaFocusControl.updateRemoteControlClientMetadata(generationId, key, value); } } Loading
media/java/android/media/IAudioService.aidl +5 −3 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.media.IRemoteControlClient; import android.media.IRemoteControlDisplay; import android.media.IRemoteControlDisplay; import android.media.IRemoteVolumeObserver; import android.media.IRemoteVolumeObserver; import android.media.IRingtonePlayer; import android.media.IRingtonePlayer; import android.media.Rating; import android.net.Uri; import android.net.Uri; import android.view.KeyEvent; import android.view.KeyEvent; Loading Loading @@ -140,7 +141,7 @@ interface IAudioService { * @param h the maximum height of the expected bitmap. Negative or zero values indicate this * @param h the maximum height of the expected bitmap. Negative or zero values indicate this * display doesn't need to receive artwork. * display doesn't need to receive artwork. */ */ oneway void registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h); boolean registerRemoteControlDisplay(in IRemoteControlDisplay rcd, int w, int h); /** /** * Unregister an IRemoteControlDisplay. * Unregister an IRemoteControlDisplay. * No effect if the IRemoteControlDisplay hasn't been successfully registered. * No effect if the IRemoteControlDisplay hasn't been successfully registered. Loading Loading @@ -178,13 +179,14 @@ interface IAudioService { */ */ void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); void setRemoteControlClientPlaybackPosition(int generationId, long timeMs); /** /** * Notify the user of a RemoteControlClient that it should update its metadata * Notify the user of a RemoteControlClient that it should update its metadata with the * new value for the given key. * @param generationId the RemoteControlClient generation counter for which this request is * @param generationId the RemoteControlClient generation counter for which this request is * issued. Requests for an older generation than current one will be ignored. * issued. Requests for an older generation than current one will be ignored. * @param key the metadata key for which a new value exists * @param key the metadata key for which a new value exists * @param value the new metadata value * @param value the new metadata value */ */ void updateRemoteControlClientMetadata(int generationId, int key, long value); void updateRemoteControlClientMetadata(int generationId, int key, in Rating value); /** /** * Do not use directly, use instead * Do not use directly, use instead Loading