Loading core/res/res/values/config.xml +6 −0 Original line number Diff line number Diff line Loading @@ -4409,4 +4409,10 @@ <item>android</item> <item>com.android.systemui</item> </string-array> <!-- Package name of custom media key dispatcher class used by MediaSessionService. --> <string name="config_customMediaKeyDispatcher"></string> <!-- Package name of custom session policy provider class used by MediaSessionService. --> <string name="config_customSessionPolicyProvider"></string> </resources> core/res/res/values/public.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3077,6 +3077,12 @@ <public name="config_sms_enabled_locking_shift_tables" /> </public-group> <public-group type="string" first-id="0x0104002c"> <!-- @hide --> <public name="config_customMediaKeyDispatcher" /> <!-- @hide --> <public name="config_customSessionPolicyProvider" /> </public-group> <!-- =============================================================== DO NOT ADD UN-GROUPED ITEMS HERE Loading core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3911,4 +3911,6 @@ <java-symbol type="string" name="notification_history_title_placeholder" /> <java-symbol type="string" name="config_customMediaKeyDispatcher" /> <java-symbol type="string" name="config_customSessionPolicyProvider" /> </resources> media/java/android/media/session/ISessionManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,6 @@ interface ISessionManager { void setOnMediaKeyListener(in IOnMediaKeyListener listener); boolean isTrusted(String controllerPackageName, int controllerPid, int controllerUid); void setCustomMediaKeyDispatcherForTesting(String name); void setCustomSessionPolicyProviderForTesting(String name); } media/java/android/media/session/MediaSessionManager.java +37 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.util.Log; import android.view.KeyEvent; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.HashMap; Loading @@ -61,7 +62,8 @@ import java.util.concurrent.Executor; * @see MediaSession * @see MediaController */ // TODO: (jinpark) Add API for getting and setting session policies from MediaSessionService. // TODO: (jinpark) Add API for getting and setting session policies from MediaSessionService once // b/149006225 is fixed. @SystemService(Context.MEDIA_SESSION_SERVICE) public final class MediaSessionManager { private static final String TAG = "SessionManager"; Loading Loading @@ -876,6 +878,40 @@ public final class MediaSessionManager { } } /** * Set the component name for the custom * {@link com.android.server.media.MediaKeyDispatcher} class. Set to null to restore to the * custom {@link com.android.server.media.MediaKeyDispatcher} class name retrieved from the * config value. * * @hide */ @VisibleForTesting public void setCustomMediaKeyDispatcherForTesting(@Nullable String name) { try { mService.setCustomMediaKeyDispatcherForTesting(name); } catch (RemoteException e) { Log.e(TAG, "Failed to set custom media key dispatcher name", e); } } /** * Set the component name for the custom * {@link com.android.server.media.SessionPolicyProvider} class. Set to null to restore to the * custom {@link com.android.server.media.SessionPolicyProvider} class name retrieved from the * config value. * * @hide */ @VisibleForTesting public void setCustomSessionPolicyProviderForTesting(@Nullable String name) { try { mService.setCustomSessionPolicyProviderForTesting(name); } catch (RemoteException e) { Log.e(TAG, "Failed to set custom session policy provider name", e); } } /** * Listens for changes to the list of active sessions. This can be added * using {@link #addOnActiveSessionsChangedListener}. Loading Loading
core/res/res/values/config.xml +6 −0 Original line number Diff line number Diff line Loading @@ -4409,4 +4409,10 @@ <item>android</item> <item>com.android.systemui</item> </string-array> <!-- Package name of custom media key dispatcher class used by MediaSessionService. --> <string name="config_customMediaKeyDispatcher"></string> <!-- Package name of custom session policy provider class used by MediaSessionService. --> <string name="config_customSessionPolicyProvider"></string> </resources>
core/res/res/values/public.xml +6 −0 Original line number Diff line number Diff line Loading @@ -3077,6 +3077,12 @@ <public name="config_sms_enabled_locking_shift_tables" /> </public-group> <public-group type="string" first-id="0x0104002c"> <!-- @hide --> <public name="config_customMediaKeyDispatcher" /> <!-- @hide --> <public name="config_customSessionPolicyProvider" /> </public-group> <!-- =============================================================== DO NOT ADD UN-GROUPED ITEMS HERE Loading
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -3911,4 +3911,6 @@ <java-symbol type="string" name="notification_history_title_placeholder" /> <java-symbol type="string" name="config_customMediaKeyDispatcher" /> <java-symbol type="string" name="config_customSessionPolicyProvider" /> </resources>
media/java/android/media/session/ISessionManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -73,4 +73,6 @@ interface ISessionManager { void setOnMediaKeyListener(in IOnMediaKeyListener listener); boolean isTrusted(String controllerPackageName, int controllerPid, int controllerUid); void setCustomMediaKeyDispatcherForTesting(String name); void setCustomSessionPolicyProviderForTesting(String name); }
media/java/android/media/session/MediaSessionManager.java +37 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.util.Log; import android.view.KeyEvent; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.HashMap; Loading @@ -61,7 +62,8 @@ import java.util.concurrent.Executor; * @see MediaSession * @see MediaController */ // TODO: (jinpark) Add API for getting and setting session policies from MediaSessionService. // TODO: (jinpark) Add API for getting and setting session policies from MediaSessionService once // b/149006225 is fixed. @SystemService(Context.MEDIA_SESSION_SERVICE) public final class MediaSessionManager { private static final String TAG = "SessionManager"; Loading Loading @@ -876,6 +878,40 @@ public final class MediaSessionManager { } } /** * Set the component name for the custom * {@link com.android.server.media.MediaKeyDispatcher} class. Set to null to restore to the * custom {@link com.android.server.media.MediaKeyDispatcher} class name retrieved from the * config value. * * @hide */ @VisibleForTesting public void setCustomMediaKeyDispatcherForTesting(@Nullable String name) { try { mService.setCustomMediaKeyDispatcherForTesting(name); } catch (RemoteException e) { Log.e(TAG, "Failed to set custom media key dispatcher name", e); } } /** * Set the component name for the custom * {@link com.android.server.media.SessionPolicyProvider} class. Set to null to restore to the * custom {@link com.android.server.media.SessionPolicyProvider} class name retrieved from the * config value. * * @hide */ @VisibleForTesting public void setCustomSessionPolicyProviderForTesting(@Nullable String name) { try { mService.setCustomSessionPolicyProviderForTesting(name); } catch (RemoteException e) { Log.e(TAG, "Failed to set custom session policy provider name", e); } } /** * Listens for changes to the list of active sessions. This can be added * using {@link #addOnActiveSessionsChangedListener}. Loading