blob: 78bba6c789889a2b8fb66838fffd98c4c9db4576 [file]
// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package androidx.browser.customtabs;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
import android.os.IBinder;
import org.chromium.build.annotations.NullMarked;
import org.chromium.build.annotations.Nullable;
/**
* Helper to access package-private methods of {@link CustomTabsSessionToken}.
*
* <p>Must reside in the base module alongside {@code androidx.browser.customtabs} so both share the
* same {@link ClassLoader} when isolated splits are enabled.
*
* <p>TODO(b/583184157): Remove once {@code CustomTabsSessionToken} exposes {@code getId()} and
* {@code getCallbackBinder()} like {@code AuthTabSessionToken}.
*/
@NullMarked
public final class CustomTabsSessionTokenUtils {
private CustomTabsSessionTokenUtils() {}
/** Returns the session ID {@link PendingIntent} from {@code token}, or null if none is set. */
@SuppressLint("RestrictedApi")
public static @Nullable PendingIntent getSessionId(CustomTabsSessionToken token) {
return token.getId();
}
/** Returns the callback {@link IBinder} from {@code token}, or null if none is set. */
@SuppressLint("RestrictedApi")
public static @Nullable IBinder getCallbackBinder(CustomTabsSessionToken token) {
return token.getCallbackBinder();
}
}