diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 45c4bec2..23873700 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -15,3 +15,4 @@ Rebecka Gulliksson Rahul Ravikumar Henning Nielsen Lund Øyvind Robertsen +Alix Warnke diff --git a/build.gradle b/build.gradle index 1360114c..f5625e18 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:4.2.1' + classpath 'com.android.tools.build:gradle:4.2.2' classpath 'org.ajoberstar.grgit:grgit-gradle:4.1.1' classpath 'org.jacoco:org.jacoco.core:0.8.7' } @@ -41,7 +41,7 @@ try { project.ext { minSdkVersion = 16 - compileSdkVersion = 31 + compileSdkVersion = 33 googleVersions = [ glide : '4.12.0', diff --git a/config/testdeps.gradle b/config/testdeps.gradle index 238fb5b2..1af474e1 100644 --- a/config/testdeps.gradle +++ b/config/testdeps.gradle @@ -1,7 +1,7 @@ testImplementation 'junit:junit:4.13.2' testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation 'org.mockito:mockito-core:3.10.0' -testImplementation 'org.robolectric:robolectric:4.5.1' +testImplementation 'org.robolectric:robolectric:4.9' testImplementation 'org.assertj:assertj-core:3.19.0' testImplementation 'androidx.test.ext:junit:1.1.3' testImplementation 'androidx.test.ext:truth:1.3.0' diff --git a/library/java/net/openid/appauth/AuthorizationManagementActivity.java b/library/java/net/openid/appauth/AuthorizationManagementActivity.java index 40842874..575d247c 100644 --- a/library/java/net/openid/appauth/AuthorizationManagementActivity.java +++ b/library/java/net/openid/appauth/AuthorizationManagementActivity.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import androidx.annotation.VisibleForTesting; import androidx.appcompat.app.AppCompatActivity; @@ -309,10 +310,16 @@ private void extractState(Bundle state) { return; } - mAuthIntent = state.getParcelable(KEY_AUTH_INTENT); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + mAuthIntent = state.getParcelable(KEY_AUTH_INTENT, Intent.class); + mCompleteIntent = state.getParcelable(KEY_COMPLETE_INTENT, PendingIntent.class); + mCancelIntent = state.getParcelable(KEY_CANCEL_INTENT, PendingIntent.class); + } else { + mAuthIntent = state.getParcelable(KEY_AUTH_INTENT); + mCompleteIntent = state.getParcelable(KEY_COMPLETE_INTENT); + mCancelIntent = state.getParcelable(KEY_CANCEL_INTENT); + } mAuthorizationStarted = state.getBoolean(KEY_AUTHORIZATION_STARTED, false); - mCompleteIntent = state.getParcelable(KEY_COMPLETE_INTENT); - mCancelIntent = state.getParcelable(KEY_CANCEL_INTENT); try { String authRequestJson = state.getString(KEY_AUTH_REQUEST, null); String authRequestType = state.getString(KEY_AUTH_REQUEST_TYPE, null); diff --git a/library/java/net/openid/appauth/browser/BrowserSelector.java b/library/java/net/openid/appauth/browser/BrowserSelector.java index 29bcb40a..585a7db5 100644 --- a/library/java/net/openid/appauth/browser/BrowserSelector.java +++ b/library/java/net/openid/appauth/browser/BrowserSelector.java @@ -104,8 +104,8 @@ public static List getAllBrowsers(Context context) { try { int defaultBrowserIndex = 0; PackageInfo packageInfo = pm.getPackageInfo( - info.activityInfo.packageName, - PackageManager.GET_SIGNATURES); + info.activityInfo.packageName, VERSION.SDK_INT >= VERSION_CODES.P + ? PackageManager.GET_SIGNING_CERTIFICATES : PackageManager.GET_SIGNATURES); if (hasWarmupService(pm, info.activityInfo.packageName)) { BrowserDescriptor customTabBrowserDescriptor = diff --git a/library/javatests/net/openid/appauth/AuthorizationServiceTest.java b/library/javatests/net/openid/appauth/AuthorizationServiceTest.java index 2010f836..3ea74d85 100644 --- a/library/javatests/net/openid/appauth/AuthorizationServiceTest.java +++ b/library/javatests/net/openid/appauth/AuthorizationServiceTest.java @@ -23,6 +23,7 @@ import android.net.Uri; import androidx.annotation.ColorInt; import androidx.annotation.Nullable; +import androidx.browser.customtabs.CustomTabColorSchemeParams; import androidx.browser.customtabs.CustomTabsClient; import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsServiceConnection; @@ -208,7 +209,8 @@ public void testAuthorizationRequest_withDefaultRandomStateAndNonce() throws Exc @Test public void testAuthorizationRequest_customization() throws Exception { CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() - .setToolbarColor(Color.GREEN) + .setDefaultColorSchemeParams(new CustomTabColorSchemeParams.Builder() + .setToolbarColor(Color.GREEN).build()) .build(); mService.performAuthorizationRequest( getTestAuthRequestBuilder().build(), diff --git a/library/javatests/net/openid/appauth/JsonUtilTest.java b/library/javatests/net/openid/appauth/JsonUtilTest.java index 4e362fba..62115603 100644 --- a/library/javatests/net/openid/appauth/JsonUtilTest.java +++ b/library/javatests/net/openid/appauth/JsonUtilTest.java @@ -44,7 +44,7 @@ public class JsonUtilTest { private static final String TEST_KEY = "key"; private static final String TEST_STRING = "value"; - private static final Long TEST_LONG = new Long(123); + private static final Long TEST_LONG = 123L; private static final String TEST_URI_STRING = "https://openid.net/"; private static final Uri TEST_URI = Uri.parse(TEST_URI_STRING); private static final JSONObject TEST_JSON = new JSONObject(); diff --git a/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java b/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java index b033fdae..7594e47b 100644 --- a/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java +++ b/library/javatests/net/openid/appauth/browser/BrowserSelectorTest.java @@ -29,6 +29,7 @@ import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.Signature; +import android.os.Build; import android.text.TextUtils; import java.nio.charset.StandardCharsets; import java.util.ArrayList; @@ -313,9 +314,10 @@ private void setBrowserList(TestBrowser... browsers) throws NameNotFoundExceptio for (TestBrowser browser : browsers) { when(mPackageManager.getPackageInfo( - eq(browser.mPackageInfo.packageName), - eq(PackageManager.GET_SIGNATURES))) - .thenReturn(browser.mPackageInfo); + eq(browser.mPackageInfo.packageName), + Build.VERSION.SDK_INT >= Build.VERSION_CODES.P + ? eq(PackageManager.GET_SIGNING_CERTIFICATES) : eq(PackageManager.GET_SIGNATURES) + )).thenReturn(browser.mPackageInfo); resolveInfos.add(browser.mResolveInfo); }