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

Commit 818fbc0a authored by Sławomir Rosek's avatar Sławomir Rosek Committed by Automerger Merge Worker
Browse files

Merge "Disable transcoding by default if no HEVC support" am: 66aafd42

parents 2216e97b 66aafd42
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -75,6 +75,9 @@ import android.content.pm.ProviderInfo;
import android.content.pm.UserInfo;
import android.content.res.ObbInfo;
import android.database.ContentObserver;
import android.media.MediaCodecList;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
import android.net.Uri;
import android.os.BatteryManager;
import android.os.Binder;
@@ -1006,10 +1009,27 @@ class StorageManagerService extends IStorageManager.Stub
        }
    }

    private boolean isHevcDecoderSupported() {
        MediaCodecList codecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
        MediaCodecInfo[] codecInfos = codecList.getCodecInfos();
        for (MediaCodecInfo codecInfo : codecInfos) {
            if (codecInfo.isEncoder()) {
                continue;
            }
            String[] supportedTypes = codecInfo.getSupportedTypes();
            for (String type : supportedTypes) {
                if (type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
                    return true;
                }
            }
        }
        return false;
    }

    private void configureTranscoding() {
        // See MediaProvider TranscodeHelper#getBooleanProperty for more information
        boolean transcodeEnabled = false;
        boolean defaultValue = true;
        boolean defaultValue = isHevcDecoderSupported() ? true : false;

        if (SystemProperties.getBoolean("persist.sys.fuse.transcode_user_control", false)) {
            transcodeEnabled = SystemProperties.getBoolean("persist.sys.fuse.transcode_enabled",