Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 858ad5e7 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge changes I7c542db9,I6f809ce2 into rvc-dev am: dc1fe789

Change-Id: I2ed871b97a8cea587e53aeeed09696ddcaf4168d
parents 83593ce7 dc1fe789
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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>
+6 −0
Original line number Diff line number Diff line
@@ -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

+2 −0
Original line number Diff line number Diff line
@@ -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>
+2 −0
Original line number Diff line number Diff line
@@ -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);
}
+37 −1
Original line number Diff line number Diff line
@@ -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;
@@ -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";
@@ -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