Skip to content

Commit 6f383ab

Browse files
author
Krzysztof Nawrot
authored
Merge pull request #20 from Parseus/dev
Dev -> master: version 2.2.1
2 parents fd01567 + 37462ad commit 6f383ab

85 files changed

Lines changed: 926 additions & 352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@
1313
app/build
1414
app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/asynclayoutinflater/R.java
1515
app/nonFree
16+
app/nonFreeMobile
17+
app/standardMobile
18+
app/standardTv
1619
app/standard
1720
.idea/kotlinc.xml

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,27 @@ android {
88
applicationId "com.parseus.codecinfo"
99
minSdkVersion 16
1010
targetSdkVersion 30
11-
versionCode 17
12-
versionName "2.1.0"
11+
versionCode 19
12+
versionName "2.2.1"
1313
resConfigs "en"
1414

1515
vectorDrawables.useSupportLibrary = true
16-
17-
manifestPlaceholders = [appName:"android.app.Application"]
1816
}
1917
buildTypes {
2018
debug {
2119
versionNameSuffix "-dev"
22-
multiDexEnabled true
23-
manifestPlaceholders = [appName:"androidx.multidex.MultiDexApplication"]
20+
if (!gradle.startParameter.taskNames.toString().contains('StandardTv')) {
21+
multiDexEnabled true
22+
manifestPlaceholders = [appName:"androidx.multidex.MultiDexApplication"]
23+
} else {
24+
manifestPlaceholders = [appName:"android.app.Application"]
25+
}
2426
}
2527
release {
2628
minifyEnabled true
2729
shrinkResources true
2830
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31+
manifestPlaceholders = [appName:"android.app.Application"]
2932
}
3033
}
3134

@@ -86,31 +89,35 @@ android {
8689

8790
configurations {
8891
nonFreeMobileImplementation {}
92+
nonFreeMobileDebugImplementation {}
93+
standardMobileDebugImplementation {}
8994
}
9095

9196
dependencies {
9297
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
9398

94-
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
95-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
96-
implementation "androidx.core:core-ktx:1.5.0-beta01"
99+
implementation 'androidx.appcompat:appcompat:1.3.0'
100+
implementation "androidx.core:core-ktx:1.5.0"
97101
implementation 'androidx.preference:preference-ktx:1.1.1'
98-
implementation 'com.google.android.material:material:1.3.0-rc01'
99102

100-
implementation 'com.github.ditacristianionut:AppInfoBadge:1.3'
101103
implementation "com.squareup.leakcanary:plumber-android:$leakCanary_version"
102104
implementation "com.squareup.moshi:moshi:$moshi_version"
103105
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
104106
implementation "com.squareup.okio:okio:2.10.0"
105107

106-
debugImplementation 'androidx.multidex:multidex:2.0.1'
107108
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakCanary_version"
109+
standardMobileDebugImplementation 'androidx.multidex:multidex:2.0.1'
110+
nonFreeMobileDebugImplementation 'androidx.multidex:multidex:2.0.1'
111+
112+
tvImplementation 'androidx.leanback:leanback:1.1.0-rc01'
113+
tvImplementation 'androidx.leanback:leanback-preference:1.1.0-rc01'
108114

109-
tvImplementation 'androidx.leanback:leanback:1.1.0-beta01'
110-
tvImplementation 'androidx.leanback:leanback-preference:1.1.0-beta01'
115+
mobileImplementation 'androidx.constraintlayout:constraintlayout:2.0.4'
116+
mobileImplementation 'com.github.ditacristianionut:AppInfoBadge:1.3'
117+
mobileImplementation 'com.google.android.material:material:1.4.0-rc01'
111118

112119
nonFreeMobileImplementation fileTree(include: ['*.jar'], dir: 'libs')
113-
nonFreeMobileImplementation 'com.google.android.play:core:1.9.1'
120+
nonFreeMobileImplementation 'com.google.android.play:core:1.10.0'
114121
nonFreeMobileImplementation ('com.google.android.play:core-ktx:1.8.1') {
115122
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
116123
}

app/proguard-rules.pro

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,4 @@
99
-dontwarn android.hardware.scontext.**
1010
-dontwarn com.samsung.**
1111
#noinspection ShrinkerUnresolvedReference
12-
-keep class com.samsung.** { *; }
13-
14-
# TODO: Remove after LeakCanary 2.7 is released
15-
# Enum values are referenced reflectively in EnumSet initialization
16-
-keepclassmembers,allowoptimization enum leakcanary.AndroidLeakFixes {
17-
public static **[] values();
18-
}
12+
-keep class com.samsung.** { *; }

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,9 @@
2525
android:icon="@mipmap/ic_launcher"
2626
android:label="@string/app_name"
2727
android:name="${appName}"
28-
android:roundIcon="@mipmap/ic_launcher_round"
2928
android:supportsRtl="true"
30-
android:theme="@style/AppTheme"
29+
android:theme="@style/Theme.CodecInfo"
3130
tools:ignore="MissingClass,RtlEnabled,UnusedAttribute">
32-
33-
<provider
34-
android:authorities="${applicationId}.fileprovider"
35-
android:name="androidx.core.content.FileProvider"
36-
android:grantUriPermissions="true"
37-
android:exported="false">
38-
<meta-data
39-
android:name="android.support.FILE_PROVIDER_PATHS"
40-
android:resource="@xml/file_paths" />
41-
</provider>
4231

4332
</application>
4433

app/src/main/assets/changelog.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<html>
22
<body>
33

4+
<h2>Version 2.3.0</h2>
5+
<p>UI improvements for bigger tablets and Chromebooks.</p>
6+
<p>App should now be resizable if Samsung DeX is enabled.</p>
7+
<p>Bugfixes and general improvements.</p>
8+
9+
<h2>Version 2.2.0</h2>
10+
<p>Added querying for System Renawability Message (SRM) properties for Widevine.</p>
11+
<p>Listing secure decoders on Android 5.0-6.0 should now be more reliable.</p>
12+
<p>Added a workaround for Oppo R9 not listing a generic raw audio decoder.</p>
13+
<p>(Android TV) Significant APK size reduction.</p>
14+
<p>Reported max resolution should be now more accurate for some codecs.</p>
15+
416
<h2>Version 2.1.0</h2>
517
<p>Codec Info will now detect and inform users about known issues with some codecs. If you know about an issue that's not being displayed, please send a feedback email about it!
618
<p>Added a notification for the user if getting a codec list is impossible due to an Android platform bug.</p>

app/src/main/java/com/parseus/codecinfo/data/codecinfo/CodecUtils.kt

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package com.parseus.codecinfo.data.codecinfo
22

33
import android.annotation.SuppressLint
44
import android.content.Context
5+
import android.media.MediaCodec
56
import android.media.MediaCodecInfo
67
import android.media.MediaCodecInfo.CodecCapabilities.*
78
import android.media.MediaCodecList
89
import android.media.MediaFormat
10+
import android.os.Build
911
import android.os.Build.VERSION.SDK_INT
1012
import android.util.Range
1113
import androidx.annotation.RequiresApi
@@ -16,10 +18,7 @@ import com.parseus.codecinfo.data.DetailsProperty
1618
import com.parseus.codecinfo.data.codecinfo.colorformats.*
1719
import com.parseus.codecinfo.data.codecinfo.profilelevels.*
1820
import com.parseus.codecinfo.data.codecinfo.profilelevels.VP9Levels.*
19-
import com.parseus.codecinfo.utils.isAudioCodec
20-
import com.parseus.codecinfo.utils.toBytesPerSecond
21-
import com.parseus.codecinfo.utils.toHexHstring
22-
import com.parseus.codecinfo.utils.toKiloHertz
21+
import com.parseus.codecinfo.utils.*
2322
import java.util.*
2423
import kotlin.collections.ArrayList
2524

@@ -39,6 +38,9 @@ private const val DIVX6_1080P_MAX_FRAME_RATE = 30
3938
private val DIVX4_MAX_RESOLUTION = intArrayOf(720, 576)
4039
private val DIVX6_MAX_RESOLUTION = intArrayOf(1920, 1080)
4140

41+
private const val GOOGLE_RAW_DECODER = "OMX.google.raw.decoder"
42+
private const val MEDIATEK_RAW_DECODER = "OMX.MTK.AUDIO.DECODER.RAW"
43+
4244
private val platformSupportedTypes = arrayOf(
4345
"audio/3gpp",
4446
"audio/amr-mb",
@@ -102,11 +104,38 @@ fun getSimpleCodecInfoList(context: Context, isAudio: Boolean): MutableList<Code
102104
return mutableListOf()
103105
}
104106
} else {
105-
@Suppress("DEPRECATION")
106-
Array(MediaCodecList.getCodecCount()) { i -> MediaCodecList.getCodecInfoAt(i) }
107+
try {
108+
@Suppress("DEPRECATION")
109+
Array(MediaCodecList.getCodecCount()) { i -> MediaCodecList.getCodecInfoAt(i) }
110+
} catch (e: Exception) {
111+
return mutableListOf()
112+
}
107113
}
108114
}
109115

116+
if (SDK_INT in 21..23 && mediaCodecInfos.find { it.name.endsWith("secure") } == null) {
117+
// Some devices don't list secure decoders on API 21 with a newer way of querying codecs,
118+
// but potentially could also happen on API levels 22 and 23.
119+
// In that case try the old way.
120+
try {
121+
@Suppress("DEPRECATION")
122+
val oldCodecInfos = Array(MediaCodecList.getCodecCount())
123+
{ i -> MediaCodecList.getCodecInfoAt(i) }.filter { it.name.endsWith("secure") }
124+
mediaCodecInfos += oldCodecInfos
125+
} catch (e: Exception) {}
126+
}
127+
128+
if (SDK_INT in 22..25 && Build.DEVICE == "R9"
129+
&& mediaCodecInfos.find { it.name == GOOGLE_RAW_DECODER } == null
130+
&& mediaCodecInfos.find { it.name == MEDIATEK_RAW_DECODER } != null) {
131+
// Oppo R9 does not list a generic raw audio decoder, yet it can be instantiated by name.
132+
try {
133+
val rawMediaCodec = MediaCodec.createByCodecName(GOOGLE_RAW_DECODER)
134+
//noinspection NewApi
135+
mediaCodecInfos += rawMediaCodec.codecInfo
136+
} catch (e: Exception) {}
137+
}
138+
110139
val showAliases = prefs.getBoolean("show_aliases", false)
111140
val filteringOption = prefs.getString("filter_type", "2")!!.toInt()
112141
var codecSimpleInfoList = ArrayList<CodecSimpleInfo>()
@@ -447,12 +476,12 @@ private fun adjustMaxInputChannelCount(codecId: String, codecName: String, maxCh
447476
}
448477
}
449478

450-
if (SDK_INT < 28) {
479+
if (CAN_USE_REFLECTION_FOR_MCAPABILITIESINFO) {
451480
/*
452481
mCapabilitiesInfo, a private MediaFormat instance hidden in MediaCodecInfo,
453482
can actually provide max input channel count (as well as other useful info).
454-
Unfortunately, with P restricting non-API usage via reflection, I can only hope
455-
that everything will work fine on newer versions.
483+
Android 9.0 put it on a dark greylist, though, so it can't be easily accessed anymore
484+
(although it is bypassed on a non-store mobile flavor). Newer versions are SOL here.
456485
*/
457486
try {
458487
val capabilitiesInfo = capabilities::class.java.getDeclaredField("mCapabilitiesInfo")
@@ -462,8 +491,7 @@ private fun adjustMaxInputChannelCount(codecId: String, codecName: String, maxCh
462491
if (mediaFormat.containsKey("max-channel-count")) {
463492
return mediaFormat.getString("max-channel-count")!!.toInt()
464493
}
465-
} catch (e: Exception) {
466-
}
494+
} catch (e: Exception) {}
467495
}
468496

469497
if (codecId.endsWith("flac") || codecId.endsWith("alac")) {
@@ -582,7 +610,7 @@ private fun addColorFormats(capabilities: MediaCodecInfo.CodecCapabilities, code
582610
private fun getFormattedColorProfileString(context: Context, colorFormat: String, colorFormatInt: Int): String {
583611
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
584612

585-
return when (prefs.getString("known_values_color_profiles", "0")!!.toInt()) {
613+
return when (prefs.getString("known_values_color_profiles", "1")!!.toInt()) {
586614
0 -> colorFormat
587615
1 -> "$colorFormat (${colorFormatInt.toHexHstring()})"
588616
else -> "$colorFormat ($colorFormatInt)"
@@ -592,7 +620,7 @@ private fun getFormattedColorProfileString(context: Context, colorFormat: String
592620
@RequiresApi(21)
593621
private fun getMaxResolution(codecId: String, videoCapabilities: MediaCodecInfo.VideoCapabilities): IntArray {
594622
val maxWidth = videoCapabilities.supportedWidths.upper
595-
val maxHeight = videoCapabilities.getSupportedHeightsFor(maxWidth).upper
623+
val maxHeight = videoCapabilities.supportedHeights.upper
596624
val defaultResolution = intArrayOf(maxWidth, maxHeight)
597625

598626
return if (!areCapabilitiesUnknown(videoCapabilities)) {
@@ -803,7 +831,7 @@ private fun getProfileLevels(context: Context, codecId: String, codecName: Strin
803831
private fun getFormattedProfileLevelString(context: Context, profile: String?, profileInt: Int,
804832
level: String?, levelInt: Int): String {
805833
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
806-
val option = prefs.getString("known_values_profile_levels", "0")!!.toInt()
834+
val option = prefs.getString("known_values_profile_levels", "1")!!.toInt()
807835
val unknownString = context.getString(R.string.unknown)
808836

809837
val profileString = when (option) {
@@ -872,7 +900,7 @@ private fun getMaxVP9ProfileLevel(capabilities: MediaCodecInfo.CodecCapabilities
872900
}
873901

874902
private fun isVendor(codecInfo: MediaCodecInfo): Boolean {
875-
val codecName = codecInfo.name.toLowerCase(Locale.ENGLISH)
903+
val codecName = codecInfo.name.lowercase(Locale.ENGLISH)
876904
return (!codecName.startsWith("omx.google.")
877905
&& !codecName.startsWith("c2.android.")
878906
&& !codecName.startsWith("c2.google.")
@@ -885,7 +913,7 @@ private fun isSoftwareOnly(codecInfo: MediaCodecInfo): Boolean {
885913
return codecInfo.isSoftwareOnly
886914
}
887915

888-
val codecName = codecInfo.name.toLowerCase(Locale.ENGLISH)
916+
val codecName = codecInfo.name.lowercase(Locale.ENGLISH)
889917

890918
// Broadcom codecs which specifically mention HW acceleration in their names
891919
if (codecName.contains("omx.brcm.video", true) && codecName.contains("hw", true)) {

app/src/main/java/com/parseus/codecinfo/data/drm/DrmVendor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ enum class DrmVendor(val uuid: UUID,
7070
R.string.drm_property_hdcp_level to "hdcpLevel",
7171
R.string.drm_property_max_hdcp_level to "maxHdcpLevel",
7272
R.string.drm_property_open_sessions to "numberOfOpenSessions",
73-
R.string.drm_property_max_sessions to "maxNumberOfSessions"
73+
R.string.drm_property_max_sessions to "maxNumberOfSessions",
74+
R.string.drm_property_current_srm_version to "CurrentSRMVersion",
75+
R.string.drm_property_srm_update_support to "SRMUpdateSupport"
7476
)
7577

7678
val WIDEVINE_BYTE_ARRAY_PROPERTIES = mapOf(

app/src/main/java/com/parseus/codecinfo/utils/Extensions.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import android.media.MediaCodecInfo
77
import java.util.*
88

99
fun Context.isTv(): Boolean {
10-
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
11-
return uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
10+
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as? UiModeManager
11+
return uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
1212
}
1313

1414
fun Int.toKiloHertz(): Float {
@@ -26,7 +26,7 @@ fun Int.toBytesPerSecond(): String {
2626
}
2727

2828
fun Int.toHexHstring(): String {
29-
return "0x${this.toString(16).toUpperCase(Locale.getDefault())}"
29+
return "0x${this.toString(16).uppercase(Locale.getDefault())}"
3030
}
3131

3232
fun ByteArray.toHexString(): String {

0 commit comments

Comments
 (0)