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

Commit 2447a289 authored by yidongh's avatar yidongh Committed by Arne Coucheron
Browse files

SoundPool: decrease binder call when calling SoundPool.play

When playing SoundPool, SoundPool will call binder to get service
every time, thus causing delay in SoundPool and performance for
apps/games will be worse.

Remove binder call at the beginning of SoundPool.play.

Change-Id: Ic6b036e5997ef9518bc62689eb1ec62d231fbcb0
CRs-Fixed: 2044501
parent b957d323
Loading
Loading
Loading
Loading
+1 −17
Original line number Diff line number Diff line
@@ -505,23 +505,6 @@ public class SoundPool {
    }

    private boolean isRestricted() {
        IAudioService service = getService();
        boolean cameraSoundForced = false;

        try {
            cameraSoundForced = service.isCameraSoundForced();
        } catch (RemoteException e) {
            Log.e(TAG, "Cannot access AudioService in isRestricted()");
        }

        if (cameraSoundForced &&
                ((mAttributes.getAllFlags() & AudioAttributes.FLAG_AUDIBILITY_ENFORCED) != 0)
// FIXME: should also check usage when set properly by camera app
//                && (mAttributes.getUsage() == AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
                ) {
            return false;
        }

        // check app ops
        if (mHasAppOpsPlayAudio) {
            return false;
@@ -534,6 +517,7 @@ public class SoundPool {
        if ((mAttributes.getAllFlags() & AudioAttributes.FLAG_AUDIBILITY_ENFORCED) != 0) {
// FIXME: should also check usage when set properly by camera app
//          && (mAttributes.getUsage() == AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
            boolean cameraSoundForced = false;
            try {
                cameraSoundForced = getService().isCameraSoundForced();
            } catch (RemoteException e) {